Code Monkey home page Code Monkey logo

qualitube's Introduction

qualitube

A Python package for YouTube qualitative data analysis. With this package you can download metadata and metrics from all videos from the given playlists' IDs. Every channel on YouTube has its own playlist with every single video uploaded by them. With this, you can take all the channels you want to study and extract their videos' data, generating a consistent corpus.

Basic usage

Installation

Create a virtual environment and install qualitube with pip:

pip install qualitube

Then, create a folder for your project. Inside it, take this repo's config-sample.ini, modify the sections so it has your YouTube Data API v3 credentials and the desired playlists' IDs. This should have the following format:

[credentials]
api_key=<PUT_HERE_YOUR_YOUTUBE_DATA_API_KEY>

[channels]
ids=
    <PUT_THE_PLAYLIST_ID_HERE>
    <PUT_ANOTHER_PLAYLIST_ID_HERE>

Inside this folder and with your qualitube virtual environment activated, simply run:

qualitube

You should see the pipeline logging messages. Your qualitative data should be in a csv file named corpus.csv. You can check if the pipeline has runned succesfully by looking at the pipeline.log generated log file too.

qualitube's People

Contributors

vmussa avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

labhdufba

qualitube's Issues

`KeyError: 'likeCount'`

I am creating an issue here because I cannot create it on LABHDUFBA repository.

I am using Videos.to_df() manually and I am getting this following error:

  File "/home/.../qualichat/frames.py", line 395, in rating
    dataframes: List[DataFrame] = [v.to_df() for v in data]
  File "/home/.../qualichat/frames.py", line 395, in <listcomp>
    dataframes: List[DataFrame] = [v.to_df() for v in data]
  File "/home/.../qualitube/videos.py", line 92, in to_df
    df = pd.DataFrame(self.get_data())
  File "/home/.../qualitube/videos.py", line 84, in get_data
    videos_data, next_page_token = self._parse_response(r.text)
  File "/home/.../qualitube/videos.py", line 47, in _parse_response
    'video_like_count': item['statistics']['likeCount'],
KeyError: 'likeCount'

Code:

data: List[Videos] = []

while all_urls:
    del all_urls[-50:]
    
    videos = Videos(videos_ids=all_urls[-50:], api_key=api_key)
    data.append(videos)

dataframes: List[DataFrame] = [v.to_df() for v in data]
print(dataframes)

`KeyError: 'items'` on `qualitube` shell command

When I type qualitube on shell terminal, I get this following exception:

INFO:root:Beginning of pipeline.
Traceback (most recent call last):
  File "/home/.../.venv/bin/qualitube", line 8, in <module>
    sys.exit(main())
  File "/home/.../qualitube/main.py", line 34, in main
    dfs = [playlist.to_df() for playlist in playlists]
  File "/home/.../qualitube/main.py", line 34, in <listcomp>
    dfs = [playlist.to_df() for playlist in playlists]
  File "/home/.../playlist_items.py", line 73, in to_df
    data = self.get_playlist_items_data()
  File "/home/.../qualitube/playlist_items.py", line 65, in get_playlist_items_data
    videos_data, next_page_token = self._parse_response(r.text)
  File "/home/.../qualitube/playlist_items.py", line 24, in _parse_response
    items = raw["items"]
KeyError: 'items'

This is my config.ini:

[credentials]
api_key=<My API Key>

[channels]
ids=
    PLdnY_glW0R2iIdYBNy9IhmHOuaS-NBo40

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.