[Python] Get Qiita trends

Purpose of this article

Get Qiita trends in Python.

Make sure Python is installed.

> python -V
Python 3.8.2

Install module

requests and beautifulsoup4

> pip install requests beautifulsoup4

Create acquisition script

qiita.py


import requests
from bs4 import BeautifulSoup
import json
import re

html = requests.get('https://qiita.com')

qiita = BeautifulSoup(html.content, "html.parser")

qiita.select('div[data-hyperapp-app="Trend"]')

target_div = qiita.select('div[data-hyperapp-app="Trend"]')[0]

trend_items = json.loads(target_div.get('data-hyperapp-props'))

for v in trend_items['trend']['edges']:
    print(v['node']['title'])

Run

> python qiita.py
5 masterpieces of data science that you can learn for free [Japanese books are not scary if you can speak English even if they are expensive]
I summarized 11 types of operating systems
Even beginners want to say "I fully understand Python"
Quick learning from super basics Docker(1)
How to create a virtual DOM
ESLint v7.0.Summary of 0 changes
Flutter Hatsumi has developed an app in a 5-day hackathon
What is "functional programming" and "object-oriented" in Python?
Build the strongest Laravel development environment using Docker [new edition]
Use case driven development for DDD that can be used from tomorrow (ICONIX process)
Enigma cryptography with simple linear algebra
Measure the rotation period of Rinsei
Let's explain mem2reg
Let's make a typing game with Processing!
Shell art that runs life games with ImageMagick
[Automation] Detects website changes and notifies LINE
I wrote the command judgment of the fighting game in Reactive
Implement ancient ciphers in python
I tried to summarize the functions required to compete in Python~itertools~
How to create a community-driven SaaS
Rotate the motor "on your own" with ST's motor control development kit Vol.1 Forced commutation
Ggplot with nested data
High Availability Solution for Oracle Database SE Standard Edition High Availability has been released
[Sad news] The holidays are over [Vue.js +Calendar created with Django REST framework]
PostgreSQL 13 is coming!(6) -Improvements to psql
API usage ranking in prototypes May 2020 version (comparison with 2015)-From smartphone apps to the physical world- #protopedia
Netlify for the first time:Minimal steps to publish your site with git push
Introducing Web Vitals and its tools that rearranged and quantified Web UX indicators into three
Deep Learning from scratch 4.4.2 Gradient with respect to neural network numerical_The question about the gradient function has been resolved.
From zero to Blazor (from project creation to login function implementation)

Recommended Posts

[Python] Get Qiita trends
Get Qiita trends with Python scraping
Get Twitter Trends
Qiita, early Python ♪
[Python] Get environment variables
[Python3] Get date diff
Get date in Python
Get date with python
python get current time
[First API] Try to get Qiita articles with Python
[Python] Get user information and article information with Qiita API
Get YouTube Comments in Python
Get Twitter timeline with python
Get Youtube data with python
Get Terminal size in Python
[Python] Get the previous month
Explicitly get EOF in python
Get thread ID with python
Get started with Python! ~ ② Grammar ~
[python] Get quotient and remainder
Get stock price with Python
Get Evernote notes in Python
python> Get substring> print serial [5:10] / print serial [5: -1]
Get home directory with python
Get keyboard events with python
IfcOpenShell python bindings get started
(Python) Get AWS billing amount
Python --bitflyer Get chat content
Get Alembic information with Python
Python> dictionary> get ()> optional value
Get Japanese synonyms in Python
Get Leap Motion data in Python.
Get started with Python! ~ ① Environment construction ~
Link to get started with python
Python
Get data from Quandl in Python
Get reviews with python googlemap api
Get the desktop path in Python
Quine Post with Qiita API (Python)
Get the weather with Python requests
Get web screen capture with python
Get the weather with Python requests 2
[Python] Get economic data with DataReader
Get the script path in Python
How to get the Python version
How to get started with Python
Get and visualize google search trends
[Small story] Get timestamp with Python
Get, post communication memo in Python
Get upcoming weather from python weather api
Get the desktop path in Python
Get the host name in Python
Python Note: Get the current month
Python version to get unused ports
Get started with Python in Blender
Get weather information with Python & scraping
I tried to get the authentication code of Qiita API with Python.
Get the number of articles accessed and likes with Qiita API + Python
[IOS] I made a widget that displays Qiita trends in Pythonista3. [Python]
Get additional data in LDAP with python
Get property information by scraping with python