Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
Allows to download private blogs
Browse files Browse the repository at this point in the history
- Allows to download private blogs (#4).
- Adds a new downloader that uses a different method to crawl the tumblr
network that allows to bypass the safe mode and download private
content, but requires a login. Thus, it's only used for private blogs
even though crawling normal, non-private blogs would be possible too.
This downloader could grab more meta information and does not require
the tumblr api.
  • Loading branch information
johanneszab committed Jul 8, 2017
1 parent 70def36 commit 8ed1e11
Show file tree
Hide file tree
Showing 7 changed files with 1,098 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@ private async Task AddBlogAsync(string blogUrl)
TransferGlobalSettingsToBlog(blog);
IDownloader downloader = DownloaderFactory.GetDownloader(blog.BlogType, shellService, crawlerService, blog);
await downloader.IsBlogOnlineAsync();

if (CheckIfTumblrPrivateBlog(blog))
{
blog = PromoteTumblrBlogToPrivateBlog(blogUrl);
downloader = DownloaderFactory.GetDownloader(blog.BlogType, shellService, crawlerService, blog);
}

await downloader.UpdateMetaInformationAsync();

lock (lockObject)
Expand All @@ -373,6 +380,25 @@ private async Task AddBlogAsync(string blogUrl)
}
}

private bool CheckIfTumblrPrivateBlog(IBlog blog)
{
if (blog.BlogType == BlogTypes.tumblr && !blog.Online)
{
return true;
}
return false;
}

private IBlog PromoteTumblrBlogToPrivateBlog(string blogUrl)
{
IBlog blog;
blog = new Blog(blogUrl, Path.Combine(shellService.Settings.DownloadLocation, "Index"), BlogTypes.tmblrpriv);
TransferGlobalSettingsToBlog(blog);
blog.BlogType = BlogTypes.tmblrpriv;
blog.Online = true;
return blog;
}

private void TransferGlobalSettingsToBlog(IBlog blog)
{
blog.DownloadAudio = shellService.Settings.DownloadAudios;
Expand Down
Loading

0 comments on commit 8ed1e11

Please sign in to comment.