project structure reworked to be compatible with pypi
This commit is contained in:
parent
de67c41254
commit
27a9d64938
|
@ -0,0 +1,38 @@
|
|||
import setuptools
|
||||
|
||||
|
||||
def _get_file_content(file_name):
|
||||
with open(file_name, 'r') as file_handler:
|
||||
return file_handler.read()
|
||||
|
||||
def get_long_description():
|
||||
return _get_file_content('README.md')
|
||||
|
||||
def get_requirements():
|
||||
return list(filter(lambda line: line != '' and not line.startswith('#'), _get_file_content('requirements.txt').split('\n')))
|
||||
|
||||
|
||||
setuptools.setup(
|
||||
name="youtube_transcript_api",
|
||||
version="0.1.0",
|
||||
author="Jonas Depoix",
|
||||
author_email="jonas.depoix@web.de",
|
||||
description="This is an python API which allows you to get the transcripts/subtitles for a given YouTube video. It also works for automatically generated subtitles and it does not require a headless browser, like other selenium based solutions do!",
|
||||
long_description=get_long_description(),
|
||||
long_description_content_type="text/markdown",
|
||||
keywords="youtube-api subtitles youtube transcripts transcript subtitle youtube-subtitles youtube-transcripts cli"
|
||||
url="https://github.com/jdepoix/youtube-transcript-api",
|
||||
packages=setuptools.find_packages(),
|
||||
classifiers=(
|
||||
"Programming Language :: Python :: 2",
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
),
|
||||
install_requires=get_requirements(),
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'youtube_transcript_api = youtube_transcript_api.__main__:main',
|
||||
],
|
||||
},
|
||||
)
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
from _api import YouTubeTranscriptApi
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
|
||||
import json
|
||||
|
@ -8,13 +6,19 @@ from pprint import pprint
|
|||
|
||||
import logging
|
||||
|
||||
from src.transcript_api import YouTubeTranscriptApi
|
||||
from _api import YouTubeTranscriptApi
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
logging.basicConfig()
|
||||
|
||||
if sys.argv[1] == '--json':
|
||||
if len(sys.argv) <= 1:
|
||||
print('No YouTube video id was found')
|
||||
elif sys.argv[1] == '--json':
|
||||
print(json.dumps(YouTubeTranscriptApi.get_transcripts(sys.argv[2:], continue_after_error=True)[0]))
|
||||
else:
|
||||
pprint(YouTubeTranscriptApi.get_transcripts(sys.argv[1:], continue_after_error=True)[0])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -6,7 +6,7 @@ import logging
|
|||
|
||||
import requests
|
||||
|
||||
from .html_unescaping import unescape
|
||||
from _html_unescaping import unescape
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -110,6 +110,7 @@ class _TranscriptParser():
|
|||
|
||||
def __init__(self, plain_data):
|
||||
self.plain_data = plain_data
|
||||
print(plain_data)
|
||||
|
||||
def parse(self):
|
||||
return [
|
Loading…
Reference in New Issue