diff --git a/README.md b/README.md index 22edcb8..8f7ed63 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,15 @@ pip3 install twitter-dl ``` usage: twitter-dl [-h] [-c CONFIDENTIAL] [-s {large,medium,small,thumb,orig}] - [--tweet] [--video] [--nophoto] + [--video] [--nophoto] [-l LIMIT] [--rts] [--thread-number THREAD_NUMBER] [--coro-number CORO_NUMBER] [--since SID] + [--tweet] [--list] resource_id dest -Download all images uploaded by a twitter user you specify +Download all images and/or videos uploaded by a twitter user you specify positional arguments: resource_id An ID of a twitter user. Also accept tweet url or @@ -29,14 +30,14 @@ optional arguments: a json file containing a key and a secret -s {large,medium,small,thumb,orig}, --size {large,medium,small,thumb,orig} specify the size of images - --tweet indicate you gived a tweet url or tweet id + --tweet indicate resource_id is a numbered tweet id + --list indicate resource_id is a list (user:slug) --video include video --nophoto exclude photo -l LIMIT, --limit LIMIT - the maximum number of tweets to check (most recent - first) + the maximum number of tweets to check (most recent first) --rts save images contained in retweets - --thread-number THREAD_NUMBER - --coro-number CORO_NUMBER - --since SID + --thread-number THREAD_NUMBER + --coro-number CORO_NUMBER + --since SID ``` diff --git a/setup.py b/setup.py index b3af963..1aad2d3 100644 --- a/setup.py +++ b/setup.py @@ -18,11 +18,10 @@ def get_version(): return version raise RuntimeError("Unable to find version string in %s" % version_file) -name = "twitter-dl" -git_repo = "https://github.com/stockbsd/{}".format(name) +git_repo = "https://github.com/stockbsd/twitter-media-dl" setup( - name=name, + name="twitter-dl", #distribution name version=get_version(), description="Download tweet images and videos", long_description=Readme, @@ -37,7 +36,7 @@ setup( url=git_repo, author="stockbsd", author_email="stockbsd@gmail.com", - keywords="twitter", + keywords="twitter, asyncio, media", project_urls={"Bug Reports": git_repo, "Source": git_repo}, classifiers=[ "Programming Language :: Python :: 3", diff --git a/twitter_dl/__init__.py b/twitter_dl/__init__.py index a3e1877..96e11c2 100644 --- a/twitter_dl/__init__.py +++ b/twitter_dl/__init__.py @@ -1,3 +1,3 @@ from .downloader import Downloader -version = "0.1.3" +version = "0.1.4" diff --git a/twitter_dl/__main__.py b/twitter_dl/__main__.py index a1d9754..5f376f7 100644 --- a/twitter_dl/__main__.py +++ b/twitter_dl/__main__.py @@ -1,11 +1,9 @@ import os import argparse import json -import re import logging from . import Downloader -from .exceptions import * def main(): @@ -36,13 +34,13 @@ def main(): ) parser.add_argument( "--tweet", - help="indicate you gived a tweet url or tweet id", + help="indicate you gived a tweet id", default=False, action="store_true", ) parser.add_argument( "--list", - help="indicate you gived a list by user:list", + help="indicate you gived a list by user:slug", default=False, action="store_true", ) @@ -76,11 +74,11 @@ def main(): with open(args.confidential) as f: confidential = json.loads(f.read()) if "consumer_key" not in confidential or "consumer_secret" not in confidential: - raise ConfidentialsNotSuppliedError() + raise RuntimeError("Confidentials Not Supplied") api_key = confidential["consumer_key"] api_secret = confidential["consumer_secret"] else: - raise ConfidentialsNotSuppliedError(args.confidential) + raise RuntimeError("Confidentials Not Supplied") downloader = Downloader(api_key, api_secret, args.thread_number, args.coro_number) diff --git a/twitter_dl/downloader.py b/twitter_dl/downloader.py index ec23960..1045754 100644 --- a/twitter_dl/downloader.py +++ b/twitter_dl/downloader.py @@ -6,7 +6,6 @@ import json import requests -from .exceptions import * from .threaded_aio_dlder import AioDownloader @@ -50,7 +49,7 @@ class Downloader: if r.status_code == 200: return r.json()["access_token"] else: - raise BearerTokenNotFetchedError() + raise RuntimeError("Bearer TokenNot Fetched") def download_media_of_tweet(self, tid, save_dest, size="large", include_video=False, include_photo=True):