【问题标题】:Instagram pagination tagInstagram 分页标签
【发布时间】:2016-12-12 20:04:00
【问题描述】:

我正在基于 instagram 进行开发,我不使用 API,因为它们不允许应用程序处于开发模式,而是允许处于生产模式。

因此,我正在尝试获取有关主题标签的以下页面,例如: https://www.instagram.com/explore/tags/plebiscito/

下一页是通过向 /query / 和 /ajax/bz 发送 POST 方法完成的,但是,尝试使用 cURL 对我不起作用。

我离开之前一直在使用 cURL。

curl "https://www.instagram.com/explore/tags/plebiscito/" --http1.1 -k "https://www.instagram.com/query/" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d "q=ig_hashtag(plebiscito)+{+media.after(j0hwe66aaaaaf0hwexjmwaaafkwa,+12)+{++count,++nodes+{++++caption,++++code,++++comments+{++++++count++++},++++comments_disabled,++++date,++++dimensions+{++++++height,++++++width++++},++++display_src,++++id,++++is_video,++++likes+{++++++count++++},++++owner+{++++++id++++},++++thumbnail_src,++++video_views++},++page_info}+}&ref=tags::show&query_id=/" --next --http1.1 -k "https://www.instagram.com/ajax/bz" -H "Content-Type: application/json" -X POST -d '{"q":[{"page_id":"7mj51x","posts":[["timespent_bit_array",{"tos_id":"7mj51x","start_time":1481556875,"tos_array":[3,0],"tos_len":2,"tos_seq":2,"tos_cum":19,"log_time":1481556876912},1481556876912,0]],"trigger":"timespent_bit_array"}],"ts":1481556877336}' --next -k "https://www.instagram.com/query/" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d "q=ig_hashtag(plebiscito)+{+media.after(j0hwe66aaaaaf0hwexjmwaaafkwa,+8)+{++count,++nodes+{++++caption,++++code,++++comments+{++++++count++++},++++comments_disabled,++++date,++++dimensions+{++++++height,++++++width++++},++++display_src,++++id,++++is_video,++++likes+{++++++count++++},++++owner+{++++++id++++},++++thumbnail_src,++++video_views++},++page_info}+}&ref=tags::show&query_id=/" --next -k "https://www.instagram.com/ajax/bz" -H "Content-Type: application/json" -X POST -d '{"q":[{"page_id":"7mj51x","posts":[["timespent_bit_array",{"tos_id":"7mj51x","start_time":1481556875,"tos_array":[3,0],"tos_len":2,"tos_seq":2,"tos_cum":19,"log_time":1481556876912},1481556876912,0]],"trigger":"timespent_bit_array"}],"ts":1481556877336}'

我在这里尝试获取第二页,但是,它以未找到的页面作为响应。

简而言之,我需要使用 Python 自动化页面,但我正在使用 cURL 进行测试。

你能帮帮我吗?非常感谢您。

【问题讨论】:

    标签: python instagram instagram-api


    【解决方案1】:

    首先,你可以得到一个jsonhttps://www.instagram.com/explore/tags/plebiscito/?__a=1,它包含page_infoend_cursor。在 GET 请求中使用 max_id=VALUE-FROM-end_cursor 进行分页。 More info here.

    如果你想使用POST /query,你需要正确的cookie。

    【讨论】:

    • 谢谢!这工作正常,被停滞了......所以当我要使用 Python 自动化这个过程时,我需要把标题放在上面吗?
    • 什么意思?哪些标头?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-20
    • 1970-01-01
    相关资源
    最近更新 更多