fyt 1.0.0 → 1.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fyt/base.rb +1 -1
- data/lib/fyt/builder.rb +1 -1
- data/lib/fyt/parser.rb +1 -1
- data/lib/fyt/storage.rb +8 -3
- data/lib/fyt.rb +7 -3
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8092f5a8ee7b7a7d00abd196a38b8f77e3b1c085
|
4
|
+
data.tar.gz: 7321598ee061f2afd9d814a1ba313ae52e35aae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cd4f4500809e7bce98fa08736ddfe1f209db04285781afcfdce40d2c48025e450cdce1ec3c23e6bbdbe3f779b5fd5341f451a8598b6683deaf1fda194d6da22
|
7
|
+
data.tar.gz: 198e910963312074d2eb278b3e976398396ee055c98adbe57b2bfef5eed418c4387a288a078f9ab0f9ee3279f889a1778dc525fe6705b8dc27601d3058689cd7
|
data/lib/fyt/base.rb
CHANGED
data/lib/fyt/builder.rb
CHANGED
@@ -41,7 +41,7 @@ module FYT
|
|
41
41
|
def add_image(youtube_url, title)
|
42
42
|
youtube_url = youtube_url.gsub('http:', 'https:')
|
43
43
|
|
44
|
-
open(youtube_url, proxy: @proxy) do |file|
|
44
|
+
open(youtube_url, proxy: 'http://' + @proxy.url) do |file|
|
45
45
|
image_url =
|
46
46
|
file.read.scan(/<meta property=\"og:image\" content=\"(.*)\">/)
|
47
47
|
.flatten.first
|
data/lib/fyt/parser.rb
CHANGED
data/lib/fyt/storage.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
module FYT
|
3
3
|
# Manages file downloads and storage
|
4
4
|
class Storage < FYT::Base
|
5
|
-
def initialize(path, format_options, output_format,
|
5
|
+
def initialize(path, format_options, output_format, proxy_manager = nil)
|
6
6
|
@path = path || ''
|
7
7
|
@format_options = format_options
|
8
8
|
@output_format = output_format
|
9
|
-
@
|
9
|
+
@proxy_manager = proxy_manager
|
10
10
|
@known_files = []
|
11
11
|
end
|
12
12
|
|
@@ -15,6 +15,7 @@ module FYT
|
|
15
15
|
|
16
16
|
path = path_for(item)
|
17
17
|
download_file!(url, path)
|
18
|
+
|
18
19
|
@known_files << File.basename(path)
|
19
20
|
File.basename(path)
|
20
21
|
end
|
@@ -50,12 +51,14 @@ module FYT
|
|
50
51
|
private
|
51
52
|
|
52
53
|
def download_file!(url, output_path)
|
54
|
+
proxy = @proxy_manager.get!
|
55
|
+
|
53
56
|
options = [
|
54
57
|
"-f '#{@format_options}'",
|
55
58
|
"--merge-output-format '#{@output_format}'",
|
56
59
|
"-o '#{output_path}'"
|
57
60
|
]
|
58
|
-
options << "--proxy '
|
61
|
+
options << "--proxy 'http://#{proxy.url}'" if proxy
|
59
62
|
options << "'#{url}'"
|
60
63
|
|
61
64
|
options_string = options.join(' ')
|
@@ -63,6 +66,8 @@ module FYT
|
|
63
66
|
logger.debug "Executing: youtube-dl #{options_string}"
|
64
67
|
|
65
68
|
execute "youtube-dl #{options_string}"
|
69
|
+
rescue
|
70
|
+
download_file!(url, output_path)
|
66
71
|
end
|
67
72
|
|
68
73
|
def execute(command_string)
|
data/lib/fyt.rb
CHANGED
@@ -7,6 +7,8 @@ require_relative 'fyt/storage'
|
|
7
7
|
|
8
8
|
require 'fileutils'
|
9
9
|
|
10
|
+
require 'proxy_fetcher'
|
11
|
+
|
10
12
|
# handles the general behaviour of FYT
|
11
13
|
module FYT
|
12
14
|
def self.lock
|
@@ -24,17 +26,19 @@ module FYT
|
|
24
26
|
|
25
27
|
def self.run
|
26
28
|
config = FYT::Config.new
|
29
|
+
manager =
|
30
|
+
ProxyFetcher::Manager.new(filters: { country: 'DE', maxtime: '500' })
|
27
31
|
storage = FYT::Storage.new(
|
28
32
|
config[:storage_path],
|
29
33
|
config[:format_options],
|
30
34
|
config[:output_format],
|
31
|
-
|
35
|
+
manager
|
32
36
|
)
|
33
37
|
|
34
38
|
config[:feeds].each do |feed_config|
|
35
|
-
source_feed = FYT::Parser.new(feed_config[:url],
|
39
|
+
source_feed = FYT::Parser.new(feed_config[:url], manager.get!).read
|
36
40
|
|
37
|
-
new_feed = FYT::Builder.new(source_feed, storage, config[:server_prefix],
|
41
|
+
new_feed = FYT::Builder.new(source_feed, storage, config[:server_prefix], manager.get!).build
|
38
42
|
|
39
43
|
storage.add_feed(feed_config[:name], new_feed)
|
40
44
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fyt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.1.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steffen Schröder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
12
|
-
dependencies:
|
11
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: proxy_fetcher
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.5'
|
13
27
|
description: Downloads a youtube channel and its videos and stores them locally as
|
14
28
|
a podcatcher-friendly feed
|
15
29
|
email: steffen@schröder.xyz
|
@@ -40,12 +54,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
54
|
version: '0'
|
41
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
56
|
requirements:
|
43
|
-
- - "
|
57
|
+
- - ">"
|
44
58
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
59
|
+
version: 1.3.1
|
46
60
|
requirements: []
|
47
61
|
rubyforge_project:
|
48
|
-
rubygems_version: 2.6.
|
62
|
+
rubygems_version: 2.6.13
|
49
63
|
signing_key:
|
50
64
|
specification_version: 4
|
51
65
|
summary: fyt
|