[PYTHON] Get AKB member's Google+ ID at once

When practicing to get data from SNS and analyze it, it is very fun to use Google+ posts of AKB group members. There is also a certain amount.

The member's Google+ ID will be output at once from the following site. http://www.google.com/intl/ja/+/project48/

We use a module called BeautifulSoup. Below is the site. http://www.crummy.com/software/BeautifulSoup/ You can install it with pip install.

I wrote the following script in Python. In this example, the result is printed, but I think that it can be used such as passing it to another process as a list and acquiring the activity sequentially.

gidprint.py



#!bin/python
#coding: utf-8

from BeautifulSoup import BeautifulSoup
import urllib

def gidlist_make():
    soup = BeautifulSoup(urllib.urlopen("http://www.google.com/intl/ja/+/project48/").read())
    lisoup=[]
    gidlist = []
    for lisoup in soup.findAll("li"):

        try:
            gidlist.append(lisoup['data-gplusid'])
        except:
            continue

    return gidlist

if __name__=='__main__':
    gidlist= gidlist_make()
    for gid in gidlist:


Recommended Posts

Get AKB member's Google+ ID at once
Get AKB48 Google+ Posts
Get out of multiple loops at once
Get a lot of Twitter tweets at once
Get corporate number at once via gbizinfo with python