-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99f0e86
commit d744714
Showing
10 changed files
with
311 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include *.txt | ||
include LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,86 @@ | ||
# Twitch Highlights Bot | ||
This is just a project I started for fun after seeing many popular YouTube channels appear that make compilation videos from popular Twitch clips. | ||
This task could be easily executed by the computer in my eyes, so I started working on a program that does exactly that: | ||
it automatically collects trending clips from twitch, edits them together to make gaming highlight videos, and uploads them to YouTube. | ||
The project is still under development and far from finished, so this README will probably not be updated until the first prototype works as expected. | ||
<br/>*//TODO: Finish the README* | ||
![trending icon](https://matchmade.tv/wp-content/uploads/2018/12/Twitch-YouTube_infographic_blog1200px630px.png) | ||
# twitch-highlights | ||
An OS-independent and easy-to-use module for creating highlight videos from trending Twitch clips. Twitch highlight videos can be created by either specifying a category or a list of streamer names. | ||
|
||
## Getting started | ||
### Installing | ||
```bash | ||
pip install twitch-highlights | ||
``` | ||
### Import | ||
```python | ||
import twitch_highlights | ||
``` | ||
|
||
|
||
## Examples | ||
### TwitchHighlights | ||
The class used to interact with the Twitch API and collect trending clips. By passing *twitch_credentials* directly to the constructor, the *login_twitch* function is called automatically. | ||
```python | ||
highlight_generator = TwitchHighlights({ | ||
"client_id": "1at6pyf0lvjk48san9j7fjak6hue2i", | ||
"client_secret": "5i2c7weuz1qmvtahrok6agi7nbqo7d" | ||
}) | ||
``` | ||
Arguments: | ||
- **twitch_credentials**: *(optional)* Dictionary storing the *client_id* and *client_sectet* keys. | ||
|
||
### login_twitch | ||
Performs the proper authentication steps using Twitch's OAuth procedure to get access to its API. This method must be called before any other methods on the TwitchHighlights object are called. | ||
|
||
```python | ||
highlight_generator = TwitchHighlights() | ||
twitch_credentials = { | ||
"client_id": "1at6pyf0lvjk48san9j7fjak6hue2i", | ||
"client_secret": "5i2c7weuz1qmvtahrok6agi7nbqo7d" | ||
} | ||
highlight_generator.login(twitch_credentials) | ||
``` | ||
Arguments: | ||
- **twitch_credentials**: Dictionary storing the *client_id* and *client_sectet* keys. | ||
|
||
|
||
### make_video_by_category | ||
Creates a highlight video consisting of trending clip from the provided category in the current directory. | ||
```python | ||
highlight_generator.make_video_by_category(category = "Just Chatting", language = "en", video_length = 500) | ||
``` | ||
Arguments: | ||
- **category**: Name of the category from which the clips are gathered (case-insensitive). | ||
- **output_name**: Name of the generated output mp4 file. Defaults to "*output_video*". | ||
- **language**: Preferred language of the clips to be included in the video. Note that the clip's language tag might not actually match the language spoken in the clip. Defaults to *None*, which means that no clips are removed. | ||
- **video_length**: Minimum length of the video to be created in seconds. Clips are added to the combined video until this length is reached. Defaults to 300. | ||
- **started_at**: Starting date/time for included clips as a datetime object in the UTC standard. Defaults to exactly one day before the time at which the method is called. | ||
- **ended_at**: Ending date/time for included clips as a datetime object in the UTC standard. Defaults to the time at which the method is called. | ||
- **target_resolution**: Tuple containing (*desired_height*, *desired_width*) to which the resolution is resized. Defaults to (1080, 1920) | ||
|
||
### make_video_by_streamer | ||
Creates a highlight video consisting of trending clip from the provided category in the current directory. | ||
```python | ||
highlight_generator.make_video_by_streamer(streamers = ["Ninja", "Myth]") | ||
``` | ||
Arguments: | ||
- **streamers**: List of streamer names to gather clips from. | ||
- **output_name**: Name of the generated output mp4 file. Defaults to "*output_video*". | ||
- **language**: Preferred language of the clips to be included in the video. Note that the clip's language tag might not actually match the language spoken in the clip. Defaults to *None*, which means that no clips are removed. | ||
- **video_length**: Minimum length of the video to be created in seconds. Clips are added to the combined video until this length is reached. Defaults to 300. | ||
- **started_at**: Starting date/time for included clips as a datetime object in the UTC standard. Defaults to exactly one day before the time at which the method is called. | ||
- **ended_at**: Ending date/time for included clips as a datetime object in the UTC standard. Defaults to the time at which the method is called. | ||
- **target_resolution**: Tuple containing (*desired_height*, *desired_width*) to which the resolution is resized. Defaults to (1080, 1920) | ||
|
||
### get_top_categories | ||
Returns a list of the names of the most trending categories on Twitch at that moment. | ||
```python | ||
highlight_generator.get_top_categories(5) | ||
``` | ||
Arguments: | ||
- **amount**: Maximum number of categories to return. Maximum: 100. Defaults to 20. | ||
|
||
## License | ||
Apache-2.0 | ||
|
||
## Contributing | ||
So far, I have been the only one who has worked on the project and it would be great if I could get an extra pair of hands. Feel free to contact me if you have any great ideas and would like contribute to this project. New features I'm currently working on are: | ||
- Copyright music detection | ||
- Adding an intro/outro to the generated video | ||
- Uploading the created video directly to YouTube | ||
- An extra ordering feature in which the user can specify a specific ordering of clips (by number of views, chronological order, etc) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
DateTime==4.3 | ||
moviepy==1.0.3 | ||
requests==2.25.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from setuptools import setup, find_packages | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
setup( | ||
author='Pelle Drijver', | ||
author_email='pelledrijver@gmail.com', | ||
url='https://github.com/pelledrijver/twitch-highlights', | ||
name='twitch-highlights', | ||
version='0.0.1', | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
description = "An OS-independent and easy-to-use module for creating highlight videos from trending Twitch clips. Twitch highlight videos can be created by either specifying a category or a list of streamer names.", | ||
py_modules={"twitch_highlights"}, | ||
install_requires = [ | ||
'requests', | ||
'datetime', | ||
'moviepy>=1.0.3' | ||
], | ||
package_dir={'':'src'}, | ||
packages=find_packages(), | ||
license='Apache License 2.0', | ||
classifiers=[ | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'License :: OSI Approved :: Apache Software License' | ||
'Operating System :: OS Independent' | ||
] | ||
) |
Oops, something went wrong.