从Nairaland获取和解析数据。

nairaland的Python项目详细描述


从Nairaland获取和解析数据的Python模块。在

目录

安装

您需要Python 3.x和{a6}。在

使用pip安装:pip install nairaland 通过回购安装:

  • 克隆报告git clone https://github.com/makinde2013/pynairaland
  • 通过pip install -r requirements.txt
  • 将pynairaland放在项目根文件夹中

用法

用户统计

fromnairalandimportNairalandimportosfromnairaland.browserimportBrowserbrowser=Browser(os.getenv('LINUX'))nairaland=Nairaland(browser)# Get front page topicsfront_page_topics=nairaland.front_page_topics()# Do stuff with the parsed activity dataprint(front_page_topics)# Get categoriescategories=nairaland.categories(depth=2)# Get category topicscategory_topics=nairaland.category_topics(category='politics',page=2)# categories are:{"data":[{"id":"9","name":"Nairaland / General","sub_categories":[],"title":" class=g","url":"https://nairaland.com/nairaland"},{"id":"12","name":"Entertainment","sub_categories":[],"title":"Entertainment threads that won't fit into any child board. class=g","url":"https://nairaland.com/entertainment"},{"id":"8","name":"Science/Technology","sub_categories":[],"title":" class=g","url":"https://nairaland.com/science"}]}# Get trending topicstopics_trending=nairaland.topics_trending(page=2)# Get latest topicslatest_topics=nairaland.new_topics(page=2)# Get latest commentslatest_comments=nairaland.recent_posts(page=2)# Get user profileuser_profile=nairaland.recent_posts(user='bolaji21',page=2)# Get user postsuser_posts=nairaland.user_posts(user='bolaji21',page=2)# Get user topicsuser_topics=nairaland.user_topics(user='bolaji21',page=2)# Get topic (thread) commentstopic_comments=nairaland.topic_posts(topic='5426482',page=2)# comments are:{"data":[{"content":"It was a battle of Zanku supremacy between Tiwa Savage and famous dancer, Poco Lee at Tiwa’s “49-99” premiere party in Obalende, Lagos.On the 17th of September would be a day to remember for some music fans as Tiwa Savage took her bubbly self and her team to entertain Lagosians for free at the very busy area of Obalende on a sunny afternoon. While the crowd that was present for the show was expecting to catch a glimpse of Tiwa Savage on stage performing her rcently released song, they got more than they had hoped for as Tiwa and Poco Lee did something that was similar to a face-off as they showed some really dope Zanku moves.Tiwa never shied away from Poco Lee’s sleek moves and she gave some really unique moves too. Watch the video below and judge who did better with the dance: https://www.youtube.com/watch?v=mkSz8mq0xfQ.https://www.thenaijafame.com.ng/2019/09/watch-tiwa-savage-battle-poco-lee-on.html?m=1","date_posted":"2019-09-19 20:51:00","likes":0,"shares":0,"user":{"name":"Chinekepikin","url":"https://nairaland.com/chinekepikin"}},{"content":"More, Watch The Full Video HERE","date_posted":"2019-09-19 20:52:00","likes":0,"shares":0,"user":{"name":"Chinekepikin","url":"https://nairaland.com/chinekepikin"}}],"meta":{"next_page":1,"page":0,"per_page":36,"previous_page":0,"total_entries":144,"total_pages":4},"topic":{"category":{"name":"Celebrities","url":"https://www.nairaland.com/celebs"},"id":"5426482","title":"Tiwa Savage Battles Poco Lee On Stage For Zanku Supremacy (Video)"}}# search for posts containing keywordsearch_results=nairaland.search(search_term='buhari',board=20,page=1)

经过身份验证的用户路由

^{pr2}$

特点

目前已实施

  • 头版主题
  • 最近的主题
  • 趋势话题
  • 最新帖子(评论)
  • 类别
  • 类别主题
  • 用户配置文件
  • 用户帖子
  • 用户主题
  • 用户跟踪板
  • 用户关注的主题
  • 用户关注的帖子
  • 共享给用户的帖子
  • 搜索
  • 创建主题
  • 用引号创建帖子(评论)
  • 喜欢/不喜欢帖子(评论)
  • 共享/取消共享帖子(评论)

待办事项

  • 单元测试
  • 重构代码使其干燥

贡献

检查一下GitHub上的问题和/或发出请求以供贡献!在

{id10}$

使用pynairaland

的项目

确认条款

  • 我把这个项目当成了锅炉板。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Spring启动启用HTTPS   actionscript 3 java中的这个[“var”+“name”]   java只匹配给定集合中一个字符的一个匹配项   java Hibernate:防止角色表中出现多个相同的条目   javajersey+Spring注入servlet请求   java HtmlEditor javafx失去焦点   java Apache Wicket AjaxRequestTarget ListView组件未刷新或更新   mysql java。无法将lang.String转换为java。sql。时间戳   java将巨大的整数文件(在一行中)拆分为具有内存限制的已排序块   安卓如何完全关闭proguard?   安装Eclipse和Android SDK后的java“无AVD可用”消息   java动态显示图像视图   java在Spring中还有哪些WebsocketClient实现?   java Glassfish需要很长时间才能重新启动   使用Java简单串行连接器将pc与arduino连接   java如何在camel文件组件配置中结合readLockCheckInterval和maxMessagesPerPoll?   单击Android时的java预览图像   java如何将字节数组转换为ByteArrayOutputStream