哔哩哔哩爬取器:以个人为中心

Overview

Open Bilibili Crawer

哔哩哔哩是一个信息非常丰富的社交平台,我们基于此构造社交网络。在该网络中,节点包括用户(up主),以及视频、专栏等创作产物;关系包括:用户之间,包括关注关系(following/follower),回复关系(评论区),转发关系(对视频or动态转发);用户对创作物,包括评论关系(包括评论文本),发弹幕关系(包括弹幕文本),点赞、投币关系等。创作物之间的关系也可以人为构建,比如所属同一类别分区,拥有50%以上的相同tag等。

综上,哔哩哔哩网络是一个信息丰富的异质网络。

我们尝试以一个人为中心,去爬取他的个人信息与创作物信息。通过对指定的一群人进行信息的爬取,我们就可以得到一张信息丰富的异质网络。所以,OBC(Open Bilibili Crawer)的输入是一个用户,或一组用户的id(mid)。

OBC目前封装了三类爬虫:==关系爬虫、个人信息爬虫和视频爬虫==。关系爬虫负责通过默认的following关系爬取用户之间的关系,构建基础用户网络;个人信息爬虫负责抓取用户尽量多的有价值信息,提供用户节点属性;视频爬虫负责爬取视频相关的文本信息与统计类信息,可以进一步丰富用户节点属性,也可以构建异质视频节点。

OBC构建的异质网络

1. 关系爬虫

由于B站限制,对自己以外的用户最多只能浏览100个关注者/粉丝,所以关系爬虫对每个用户最多爬取100个他的关注者。对于大V来说,关注者数量通常远小于粉丝的数量,所以这种采样方法可以尽量减少网络结构的偏差。该爬虫返回三元组的列表,字段包括:

字段名 含义 备注
from_nd 中心用户mid
to_nd 中心用户关注的用户mid
rel_type 默认为“following”

这样的含义是:from_nd关注了to_nd。

2. 个人信息爬虫

个人信息分散在多个接口中,我们爬取的个人信息字段包括:

字段名 含义 备注
nfollowing 关注者数量
nfollower 粉丝数量
uname 用户名
sex 性别 男 女 保密
sign 个人简介
level b站等级 0-6的整数
official 官方头衔 以、分隔的字符串,分隔后每个元素都是一个头衔
birthday 生日 MM-DD格式,如01-01
school 学校
profession 职业
video_view 视频总播放量
article_view 专栏总阅读量
nlike 总点赞数

还有视频投稿数等一些指标没有集成进来。不过这些应该足够作为节点属性了。

3. 视频爬虫

该爬虫首先找到个人最近投稿的最多50条视频,然后对每条视频抓取一些文本信息和统计量。视频条数可以扩充。

文本信息包括视频所属类别(typeid)和视频的标签(tag 、tid)。爬虫还会存储所有遇见过的标签的信息,包括标签的题目、tid、关注该标签的人数、使用过该标签的人数等。此外,只需要建立typeid和标签的关联就可以大致判断出typeid代表的分区类型。统计量包括视频播放量等一系列数值。此外,接口还提供了视频时长、视频发布时间等更多的指标,这些并没有集成进来。

目前,每个人的视频信息包括:

    "mid" : 359797,      //mid
    "video_type" : {     //对视频所属种类的统计,视频种类以typeid代表
        "138" : 44,
        "21" : 4,
        "240" : 1,
        "28" : 1
    },
    "video_tag" : {     //对视频的标签出现频次按照降序排列,最多存50个,标签以标签id(tid)代表,可以在全局存标签信息的数据中查找到对应的标签名
        "1711163" : 38,
        "1833" : 17,
        "7662089" : 11,
        "6497596" : 10,
        "13926" : 9,
        ...
        "19327" : 1,
        "34356" : 1
    },
    "video_stat" : [   // 列表,每个元素都是视频的一些统计信息,包括8个指标
        {
            "aid" : 848235319,
            "bvid" : "BV1ZL4y1872w",
            "view" : 84679,
            "danmaku" : 107,  // 弹幕数
            "reply" : 273,
            "favorite" : 299,
            "coin" : 302,
            "share" : 309,
            "like" : 5082,
            "his_rank" : 0  // 0以外越小越好
        }, 
        {
            "aid" : 848011693,
            "bvid" : "BV1aL4y1a77s",
            "view" : 3128993,
            "danmaku" : 1767,
            "reply" : 4511,
            "favorite" : 33329,
            "coin" : 21221,
            "share" : 46047,
            "like" : 177489,
            "his_rank" : 34
        }, 
        ...
        ]

可以这样利用视频信息:

  1. 对每个人取topK个标签,把标签编码为向量后作为用户节点的属性之一
  2. 取每个人的视频所属类别最多的那个类别(typeid)作为用户节点的标签,看成K类别的多分类问题
  3. 视频的统计量,每个指标取sum/mean/max作为用户节点属性的一个维度

每个标签的信息如下:

{
	"tid" : 1767558,
    "tag_name" : "VLOG日常",
    "subscribe" : 5225,  // 关注数
    "use" : 1447949,     // 使用数
    "feature" : 0
}

4. Future Work

OBC建立在已圈定一批用户的基础上,对这批用户构造信息丰富的网络结构。如何圈定用户不在OBC职能之内。

未来工作包括:

  1. 构造异质节点和边:目前虽然可以构造视频节点,但用户和视频之间只有”发布视频“一种关系,还没有办法增加其他”用户--视频“关系如点赞、评论等。
  2. 本网络能服务于哪些下游任务?需要我们和看到此项目的各位一同思考。
  3. 增强OBC性能:添加代理、多线程等。
Owner
Boshen Shi
Devoted to my true belief
Boshen Shi
Simple Web scrapper Bot to scrap webpages using Requests, html5lib and Beautifulsoup.

WebScrapperRoBot Simple Web scrapper Bot to scrap webpages using Requests, html5lib and Beautifulsoup. Mark your Star ⭐ ⭐ What is Web Scraping ? Web s

Nuhman Pk 53 Dec 21, 2022
Scrap the 42 Intranet's elearning videos in a single click

42intra_scraper Scrap the 42 Intranet's elearning videos in a single click. Why you would want to use it ? Adjust speed at your convenience. (The intr

Noufel 5 Oct 27, 2022
ChromiumJniGenerator - Jni Generator module extracted from Chromium project

ChromiumJniGenerator - Jni Generator module extracted from Chromium project

allenxuan 4 Jun 12, 2022
Using Python and Pushshift.io to Track stocks on the WallStreetBets subreddit

wallstreetbets-tracker Using Python and Pushshift.io to Track stocks on the WallStreetBets subreddit.

91 Dec 08, 2022
Consulta de CPF e CNPJ na Receita Federal com Web-Scraping

Repositório contendo scripts Python que realizam a consulta de CPF e CNPJ diretamente no site da Receita Federal.

Josué Campos 5 Nov 29, 2021
IGLS - Instagram Like Scraper CLI tool

IGLS - Instagram Like Scraper It's a web scraping command line tool based on python and selenium. Description This is a trial tool for learning purpos

Shreshth Goyal 5 Oct 29, 2021
Dailyiptvlist.com Scraper With Python

Dailyiptvlist.com scraper Info Made in python Linux only script Script requires to have wget installed Running script Clone repository with: git clone

1 Oct 16, 2021
Incredibly fast crawler designed for OSINT.

Photon Incredibly fast crawler designed for OSINT. Photon Wiki • How To Use • Compatibility • Photon Library • Contribution • Roadmap Key Features Dat

Somdev Sangwan 9.3k Jan 02, 2023
Simple python tool for the purpose of swapping latinic letters with cirilic ones and vice versa in txt, docx and pdf files in Serbian language

Alpha Swap English This is a simple python tool for the purpose of swapping latinic letters with cirylic ones and vice versa, in txt, docx and pdf fil

Aleksandar Damnjanovic 3 May 31, 2022
👨🏼‍⚖️ reddit bot that turns comment chains into ace attorney scenes

Ace Attorney reddit bot 👨🏼‍⚖️ Reddit bot that turns comment chains into ace attorney scenes. You'll need to sign up for streamable and reddit and se

763 Nov 17, 2022
A Python web scraper to scrape latest posts from official Coinbase's Blog.

Coinbase Blog Scraper A Python web scraper to scrape latest posts from official Coinbase's Blog. IDEA It scrapes up latest blog posts from https://blo

Lucas Villela 3 Feb 18, 2022
Create crawler get some new products with maximum discount in banimode website

crawler-banimode create crawler and get some new products with maximum discount in banimode website. این پروژه کوچک جهت یادگیری و کار با ابزار سلنیوم

nourollah rezaei 2 Feb 17, 2022
Python script for crawling ResearchGate.net papers✨⭐️📎

ResearchGate Crawler Python script for crawling ResearchGate.net papers About the script This code start crawling process by urls in start.txt and giv

Mohammad Sadegh Salimi 4 Aug 30, 2022
A command-line program to download media, like and unlike posts, and more from creators on OnlyFans.

onlyfans-scraper A command-line program to download media, like and unlike posts, and more from creators on OnlyFans. Installation You can install thi

185 Jul 23, 2022
This tool crawls a list of websites and download all PDF and office documents

This tool crawls a list of websites and download all PDF and office documents. Then it analyses the PDF documents and tries to detect accessibility issues.

AccessibilityLU 7 Sep 30, 2022
Works very well and you can ask for the type of image you want the scrapper to collect.

Works very well and you can ask for the type of image you want the scrapper to collect. Also follows a specific urls path depending on keyword selection.

Memo Sim 1 Feb 17, 2022
茅台抢购最新优化版本,茅台秒杀,优化了抢购协程队列

茅台抢购最新优化版本,茅台秒杀,优化了抢购协程队列

MaoTai 33 Sep 03, 2022
Visual scraping for Scrapy

Portia Portia is a tool that allows you to visually scrape websites without any programming knowledge required. With Portia you can annotate a web pag

Scrapinghub 8.7k Jan 05, 2023
Google Maps crawler using Selenium

Google Maps Crawler using Selenium Built as part of the Antifragile Dev Project Selenium crawler that browses Google Maps as a regular user and stores

Guilherme Latrova 46 Dec 16, 2022
Footballmapies - Football mapies for learning webscraping and use of gmplot module in python

Footballmapies - Football mapies for learning webscraping and use of gmplot module in python

1 Jan 28, 2022