Python:BeautifulSoup缺少标记

2024-04-25 11:35:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我编写了一个python程序,它列出了这个page上的所有子项。我正在使用BeautifulSoup(BS)。很好用。问题是BS缺少页面中的所有nsfw sub。你知道吗

我的程序输出

http://www.reddit.com/subreddits
http://www.reddit.com/r/funny/
http://www.reddit.com/r/pics/
http://www.reddit.com/r/AdviceAnimals/
http://www.reddit.com/r/todayilearned/
http://www.reddit.com/r/gifs/
http://www.reddit.com/r/BlackPeopleTwitter/
http://www.reddit.com/r/videos/
http://www.reddit.com/r/WTF/
http://www.reddit.com/r/aww/
http://www.reddit.com/r/AskReddit/
http://www.reddit.com/r/gaming/
http://www.reddit.com/r/leagueoflegends/
http://www.reddit.com/r/worldnews/
http://www.reddit.com/r/me_irl/
http://www.reddit.com/r/news/
http://www.reddit.com/r/pcmasterrace/
http://www.reddit.com/r/politics/
http://www.reddit.com/r/4chan/
http://www.reddit.com/r/trees/
http://www.reddit.com/r/TrollXChromosomes/
http://www.reddit.com/r/space/
http://www.reddit.com/r/Showerthoughts/
http://www.reddit.com/r/mildlyinteresting/
http://www.reddit.com/r/GlobalOffensive/
http://www.reddit.com/r/movies/

与实际的子reddit列表完全同步。所以我想知道为什么它缺少nsfw潜艇。当我看到页面的源代码时,与其他sfw sub没有什么不同。谢谢。你知道吗

如果需要任何其他信息,请询问。你知道吗

谢谢

编辑:原来,当我向reddit发出请求时,它没有任何cookies。默认情况下,您将显示SFW sub reddits Byreddit.com网站. 为了在python中模拟浏览器体验,必须使用浏览器的cookies。你知道吗


Tags: 程序comhttpbswwwpage浏览器页面