Giter Club home page Giter Club logo

tumblr-crawler-cli's Introduction

English | 简体中文

tumblr-crawler-cli

Tumblr Download Tool with High Speed and Customization. preview

Feature

  • Rich command line parameters support.
  • Multi-threaded Download support.
  • File will be download completely.
  • Custom filename format.
  • Support crawler multiple sites at the same time.
  • Python2 & Python3 Compatibility.

Prepare

$ git clone [email protected]:tzw0745/tumblr-crawler-cli.git
$ cd tumblr-crawler-cli
$ pip install -r requirements.txt  # -i https://pypi.tuna.tsinghua.edu.cn/simple/
$ python tumblr-crawler.py --help

NOTICE: if you want use socks proxy for this program, you need install another package: pySocks

$ pip install pySocks

Usage

usage: tumblr-crawler.py [-h] [-p] [-v] [-d SAVE_DIR] [-f FN_FMT] [-x PROXY]
                         [-n THREAD_NUM] [--min MIN_SIZE] [--overwrite]
                         [--interval INTERVAL] [--retries RETRIES]
                         sites [sites ...]

Crawler Tumblr Photos and Videos

positional arguments:
  sites                 tumblr sites

optional arguments:
  -h, --help            show this help message and exit
  -p, --photo           whether to download photo
  -v, --video           whether to download video
  -d SAVE_DIR, --dir SAVE_DIR
                        download file save directory
  -f FN_FMT, --format FN_FMT
                        filename format
  -x PROXY, --proxy PROXY
                        http request agent, support http/socks
  -n THREAD_NUM, --thread THREAD_NUM
                        number of download threads, default is 5
  --min MIN_SIZE        minimum size of downloaded files, default is 0k
                        (unlimited)
  --overwrite           overwrite file (if it exists)
  --interval INTERVAL   http request interval, default is 0.5 (seconds)
  --retries RETRIES     http request retries, default is 3

Example

$ python tumblr-crawler.py liamtbyrne lizclimo
  • specify the download file type:
$ python tumblr-crawler.py -p liamtbyrne  # download photos only
$ python tumblr-crawler.py --video liamtbyrne  # download videos only
  • you want put download all files to another directory:
$ python tumblr-crawler.py -d /somedir/ liamtbyrne
  • you want custom filename format:
$ python tumblr-crawler.py -f "{date:%Y-%m-%d %H.%M.%S} GMT.{post_id}.{uid}" liamtbyrne  # default
$ python tumblr-crawler.py --format {uid} liamtbyrne

first example will save file like: "2015-10-16 06.04.53 GMT.13126.5pzVb1s7wpcjo10.jpg" second example will save file like: "5pzVb1s7wpcjo10.jpg" {uid} is necessary, other optional parameter include:

  • {post_id}: id of tumblr post, like 13126;
  • {type}: video or photo;
  • {date}: datetime of tumblr post, support detailed settings;
  • {timestamp}: unix timestamp, like 1541405838.
  • you want use proxy for download files:
$ python tumblr-crawler.py --proxy http://127.0.0.1:1080 liamtbyrne  # http proxy
$ python tumblr-crawler.py -x socks5h://127.0.0.1:1080 liamtbyrne  # socket5 proxy
  • you want set more thread to speed up the download speed:
$ python tumblr-crawler.py -n 20 liamtbyrne
  • you only want to download files larger than a certain size:
$ python tumblr-crawler.py --min 0.5m liamtbyrne  # only download files larger than 512k
$ python tumblr-crawler.py --min 100k liamtbyrne  # only download files larger than 100k

Coming Feature

  • Configure file.
  • ...

Change log

  • 2018-12-17:
    • improve image url compatibility.
  • 2018-12-05:
    • support inline photo url.
  • 2018-11-05:
    • support custom filename format.
  • 2018-10-09:
    • update command line args.
  • 2018-10-06:
    • add minimum file size support.
  • 2018-10-04:
    • asynchronous & multi-thread parse tumblr site;
    • optimize code structure;
    • modify command line parameters.
  • 2018-10-03:
    • optimize media extraction compatibility.
  • 2018-09-29:
    • Add Temporary File Support to make sure file download completely;
    • add file count hint after program completed;
    • fix args parse bug;
    • fix multi thread bug.
  • 2018-09-28:
    • First version.

tumblr-crawler-cli's People

Contributors

tzw0745 avatar wolf-joe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tumblr-crawler-cli's Issues

关于爬取图片的问题

当前代码只能爬取到特定的图片
当博主点击撰写博文时选择的是 图片来编辑内容时,其中图片可以正常爬取
当博主点击撰写博文时选择 文章 来编辑内容时,文章中的图片不能被爬取
用例:https://studykkkk.tumblr.com/
链接共有两条博文,测试只能爬取出其中一条内的图片。
海贼图片的博文是通过选择文章来发送的,不能被爬取。

视频抓取有遗漏

首先非常感谢你的代码!(趁着tumblr还没有完全关,赶紧备份……)
图片抓取应该没什么问题(也可能是我暂时没有检查出来)
但是可以发现视频抓取有遗漏
执行代码
python tumblr-crawler.py --video wanimal1983
抓取的视频共有25个,而实际上从以下地址看到所有的视频
http://wanimal1983.org/archive/filter-by/video
我数了数共有48个,遗漏了不少,请问是什么原因导致的?

Suggestion for enhancement

Thanks for the effort on the tumblr-crawler-cli, after several try with it, I have some suggestion for enhancement.

  1. Suggest to have a .txt file to list the name of tumblr site.

  2. Suggest to allow the authentication so that the private site we can still use an account to do it.

Feature Request

hi,
Have you considered about adding some features ?
Just like, em...

  • Use the original 'raw file' for higher quality photos? Replace the 1280px image files if these raw image files exist.
  • Is it possible to filter out the image files of a specified size? Just like save the image files larger than 100k only.
  • For these private blogs, is it possible to authenticate over the CLI or a configuration file just like the cookie file 😄

获取图片url越界

File "tumblr-crawler.py", line 106, in parse_site_thread
uid = re.findall(r'tumblr_([a-zA-Z0-9]{15,})', photo_url)[0]
IndexError: list index out of range

加了个判断:
if re.findall(r'tumblr_([a-zA-Z0-9]{15,})', photo_url):
就没问题了

抓取没有内容

我按照使用方式正确的到了抓取这一步,然后终端打印是start了,接着得到的打印是这样的:
Thread 4 RequestException: /Users/edwardlear/Desktop/liamtbyrne/liamtbyrne/2015-10-16 06.04.53 GMT.131269594843.nwau85pzVb1s7wpcjo6.jpg

然后我到相应的文件夹下查看,没有任何文件生成。请问我是哪一步做错了吗?

我发现是VPN的问题。。不好意思

关于README

README里运行程序的命令里,程序名好像打错了。

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.