File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,18 +12,21 @@ args:
1212 description : Number of topics
1313
1414pipeline :
15- - navigate : https://www.v2ex.com/api/topics/hot.json
15+ - navigate : https://www.v2ex.com/
1616
1717 - evaluate : |
1818 (async () => {
19- // 获取页面中的JSON数据
20- const preElement = document.querySelector('pre');
21- if (preElement) {
22- const jsonText = preElement.textContent;
23- const data = JSON.parse(jsonText);
24- return data;
19+ const response = await fetch('/api/topics/hot.json', {
20+ credentials: 'include',
21+ headers: {
22+ accept: 'application/json, text/plain, */*',
23+ 'x-requested-with': 'XMLHttpRequest',
24+ },
25+ });
26+ if (!response.ok) {
27+ throw new Error(`V2EX hot API request failed: ${response.status}`);
2528 }
26- return [] ;
29+ return await response.json() ;
2730 })()
2831
2932 - map :
You can’t perform that action at this time.
0 commit comments