从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在Eclipse中使用ctrlshiftt而不是ctrlshiftr有什么好处?   java自动装箱概念SCJP   java如何使用JAXR和Resteasy、Angular和Wildfly10处理COR   java如何在整数数组中动态添加元素?   JAVA从继承生成器模式返回父对象继承   java问题调试生产者消费者问题   java MQ:已达到通道的最大实例数   JavaPowerMockMockito:我试图stubb的方法最终被调用   java Hibernate将多个列映射到一个表   在java中,将字符串中的单词大写,但跳过字符串中的数字和多余空格或符号   使用Eclipse将Java项目导出到JAR时出现“重复条目”错误   java使用eclipselink在实体表上指定NullConstraint   <Java>我可以在TCPIP中使用多个服务器socket吗?   带有自定义视图的java AlertDialog:调整大小以包装视图的内容   如何从用C#编写的web服务生成用于java的SOAP API?