作者totte (totte)
看板Python
标题[问题] midjourney 爬虫问题请教
时间Fri Jul 7 21:31:18 2023
大家好
目前我写的 midjourney 爬虫遇到问题,想请教一下如何解决
环境是租来的 vps (主机在美国)
os 是 ubuntu 22.04
爬取的步骤是先透过 get 程式如下
https://gist.github.com/HankChangGSS/8e45d1e2b836923c30118e762a59f530
透过上述回传的 html
拆解出 form id="challenge-form" 其中的 action 位置 以及
input
发出请求的程式如下
https://gist.github.com/HankChangGSS/c0732ba1e85e8ed3c5e86af2389b1fed
但是此段程式的回传不符预期
我期望得到的回传是能够像人工开启浏览器,访问
https://www.midjourney.com/showcase/recent/
其中会有回传以下区段
<script id="__NEXT_DATA__" type="application/json">
以便後续能剖析 json 里面的资料
但目前用程式来发送请求,不知程式的写法哪里有问题,
导致 server 回传上述的 json 资料?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.245.121.125 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1688736680.A.0B8.html
1F:推 aalexx: “上述的json资料”忘记附? 07/08 07:02