Skip to content

Commit

Permalink
fix(route): segmentfault invalid header error
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudoyu committed Oct 22, 2024
1 parent 8f1e290 commit f87db32
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/routes/segmentfault/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import zlib from 'zlib';
import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
Expand All @@ -12,14 +11,11 @@ const acw_sc__v2 = (link, tryGet) =>
'segmentfault:acw_sc__v2',
async () => {
const response = await got(link, {
decompress: false,
decompress: true,
});

const unzipData = zlib.createUnzip();
unzipData.write(response.body);

let acw_sc__v2 = '';
for await (const data of unzipData) {
for await (const data of response.body) {
const strData = data.toString();
const matches = strData.match(/var arg1='(.*?)';/);
if (matches) {
Expand Down

0 comments on commit f87db32

Please sign in to comment.