article_json 0.3.7 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +118 -67
- data/bin/article_json_export_amp.rb +15 -0
- data/bin/article_json_export_apple_news.rb +15 -0
- data/bin/article_json_export_facebook.rb +16 -0
- data/bin/article_json_export_html.rb +1 -0
- data/bin/article_json_export_plain_text.rb +15 -0
- data/bin/article_json_parse_google_doc.rb +1 -0
- data/bin/check_google_doc_export.rb +41 -0
- data/bin/update_oembed_request-stubs.sh +11 -0
- data/bin/update_reference_document.sh +16 -0
- data/lib/article_json/article.rb +22 -2
- data/lib/article_json/configuration.rb +2 -1
- data/lib/article_json/elements/base.rb +0 -1
- data/lib/article_json/elements/image.rb +7 -3
- data/lib/article_json/export/amp/elements/embed.rb +1 -1
- data/lib/article_json/export/apple_news/elements/base.rb +53 -0
- data/lib/article_json/export/apple_news/elements/embed.rb +130 -0
- data/lib/article_json/export/apple_news/elements/heading.rb +32 -0
- data/lib/article_json/export/apple_news/elements/image.rb +58 -0
- data/lib/article_json/export/apple_news/elements/list.rb +67 -0
- data/lib/article_json/export/apple_news/elements/paragraph.rb +36 -0
- data/lib/article_json/export/apple_news/elements/quote.rb +60 -0
- data/lib/article_json/export/apple_news/elements/text.rb +42 -0
- data/lib/article_json/export/apple_news/elements/text_box.rb +51 -0
- data/lib/article_json/export/apple_news/exporter.rb +37 -0
- data/lib/article_json/export/common/html/elements/image.rb +1 -1
- data/lib/article_json/import/google_doc/html/image_parser.rb +24 -3
- data/lib/article_json/import/google_doc/html/node_analyzer.rb +11 -1
- data/lib/article_json/import/google_doc/html/parser.rb +6 -1
- data/lib/article_json/utils/o_embed_resolver/facebook_video.rb +17 -1
- data/lib/article_json/utils/o_embed_resolver/youtube_video.rb +1 -1
- data/lib/article_json/version.rb +1 -1
- data/lib/article_json.rb +11 -0
- metadata +37 -15
@@ -11,7 +11,8 @@ module ArticleJSON
|
|
11
11
|
# The URL for the oembed API call
|
12
12
|
# @return [String]
|
13
13
|
def oembed_url
|
14
|
-
"https://
|
14
|
+
"https://graph.facebook.com/v9.0/oembed_video?url=#{source_url}" \
|
15
|
+
"&access_token=#{access_token}"
|
15
16
|
end
|
16
17
|
|
17
18
|
# The video URL of the element
|
@@ -19,6 +20,21 @@ module ArticleJSON
|
|
19
20
|
def source_url
|
20
21
|
"https://www.facebook.com/facebook/videos/#{@element.embed_id}"
|
21
22
|
end
|
23
|
+
|
24
|
+
# The facebook access token. If not set, it raises an exception
|
25
|
+
# explaining how to configure it.
|
26
|
+
#
|
27
|
+
# @return [String]
|
28
|
+
def access_token
|
29
|
+
token = ArticleJSON.configuration.facebook_token
|
30
|
+
|
31
|
+
if token.nil?
|
32
|
+
raise 'You need to configure the facebook token to use facebook' \
|
33
|
+
'embed videos, see:' \
|
34
|
+
'https://github.com/Devex/article_json#facebook-oembed'
|
35
|
+
end
|
36
|
+
token
|
37
|
+
end
|
22
38
|
end
|
23
39
|
end
|
24
40
|
end
|
@@ -11,7 +11,7 @@ module ArticleJSON
|
|
11
11
|
# The URL for the oembed API call
|
12
12
|
# @return [String]
|
13
13
|
def oembed_url
|
14
|
-
"
|
14
|
+
"https://www.youtube.com/oembed?format=json&url=#{source_url}"
|
15
15
|
end
|
16
16
|
|
17
17
|
# The video URL of the element
|
data/lib/article_json/version.rb
CHANGED
data/lib/article_json.rb
CHANGED
@@ -77,6 +77,17 @@ require_relative 'article_json/export/html/elements/quote'
|
|
77
77
|
require_relative 'article_json/export/html/elements/embed'
|
78
78
|
require_relative 'article_json/export/html/exporter'
|
79
79
|
|
80
|
+
require_relative 'article_json/export/apple_news/elements/base'
|
81
|
+
require_relative 'article_json/export/apple_news/elements/text'
|
82
|
+
require_relative 'article_json/export/apple_news/elements/heading'
|
83
|
+
require_relative 'article_json/export/apple_news/elements/paragraph'
|
84
|
+
require_relative 'article_json/export/apple_news/elements/list'
|
85
|
+
require_relative 'article_json/export/apple_news/elements/image'
|
86
|
+
require_relative 'article_json/export/apple_news/elements/embed'
|
87
|
+
require_relative 'article_json/export/apple_news/elements/quote'
|
88
|
+
require_relative 'article_json/export/apple_news/elements/text_box'
|
89
|
+
require_relative 'article_json/export/apple_news/exporter'
|
90
|
+
|
80
91
|
require_relative 'article_json/export/amp/elements/base'
|
81
92
|
require_relative 'article_json/export/amp/elements/text'
|
82
93
|
require_relative 'article_json/export/amp/elements/paragraph'
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: article_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Sager
|
8
8
|
- Manu Campos
|
9
9
|
- Nicolas Fricke
|
10
|
-
|
10
|
+
- Damien Dillon
|
11
|
+
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2024-02-14 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: nokogiri
|
@@ -46,14 +47,14 @@ dependencies:
|
|
46
47
|
requirements:
|
47
48
|
- - "~>"
|
48
49
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
50
|
+
version: '2.2'
|
50
51
|
type: :development
|
51
52
|
prerelease: false
|
52
53
|
version_requirements: !ruby/object:Gem::Requirement
|
53
54
|
requirements:
|
54
55
|
- - "~>"
|
55
56
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
57
|
+
version: '2.2'
|
57
58
|
- !ruby/object:Gem::Dependency
|
58
59
|
name: rspec
|
59
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,12 +97,17 @@ dependencies:
|
|
96
97
|
- - "~>"
|
97
98
|
- !ruby/object:Gem::Version
|
98
99
|
version: '0.8'
|
99
|
-
description: |
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
description: |2
|
101
|
+
`article_json` is a format definition for news articles and a ruby gem that
|
102
|
+
offers conversions from and to different formats:
|
103
|
+
- Parser for Google Doc HTML exports
|
104
|
+
- Converter to:
|
105
|
+
- simple HTML format
|
106
|
+
- AMP format
|
107
|
+
- Apple News Format (ANF)
|
108
|
+
- Facebook Instant Article HTML
|
109
|
+
- plain text
|
110
|
+
- JSON
|
105
111
|
email: info@devex.com
|
106
112
|
executables: []
|
107
113
|
extensions: []
|
@@ -111,9 +117,15 @@ files:
|
|
111
117
|
- CODE_OF_CONDUCT.md
|
112
118
|
- LICENSE
|
113
119
|
- README.md
|
120
|
+
- bin/article_json_export_amp.rb
|
121
|
+
- bin/article_json_export_apple_news.rb
|
122
|
+
- bin/article_json_export_facebook.rb
|
114
123
|
- bin/article_json_export_google_doc.rb
|
115
124
|
- bin/article_json_export_html.rb
|
125
|
+
- bin/article_json_export_plain_text.rb
|
116
126
|
- bin/article_json_parse_google_doc.rb
|
127
|
+
- bin/check_google_doc_export.rb
|
128
|
+
- bin/update_oembed_request-stubs.sh
|
117
129
|
- bin/update_reference_document.sh
|
118
130
|
- lib/article_json.rb
|
119
131
|
- lib/article_json/article.rb
|
@@ -138,6 +150,16 @@ files:
|
|
138
150
|
- lib/article_json/export/amp/elements/text.rb
|
139
151
|
- lib/article_json/export/amp/elements/text_box.rb
|
140
152
|
- lib/article_json/export/amp/exporter.rb
|
153
|
+
- lib/article_json/export/apple_news/elements/base.rb
|
154
|
+
- lib/article_json/export/apple_news/elements/embed.rb
|
155
|
+
- lib/article_json/export/apple_news/elements/heading.rb
|
156
|
+
- lib/article_json/export/apple_news/elements/image.rb
|
157
|
+
- lib/article_json/export/apple_news/elements/list.rb
|
158
|
+
- lib/article_json/export/apple_news/elements/paragraph.rb
|
159
|
+
- lib/article_json/export/apple_news/elements/quote.rb
|
160
|
+
- lib/article_json/export/apple_news/elements/text.rb
|
161
|
+
- lib/article_json/export/apple_news/elements/text_box.rb
|
162
|
+
- lib/article_json/export/apple_news/exporter.rb
|
141
163
|
- lib/article_json/export/common/elements/base.rb
|
142
164
|
- lib/article_json/export/common/html/elements/base.rb
|
143
165
|
- lib/article_json/export/common/html/elements/embed.rb
|
@@ -214,7 +236,7 @@ homepage: https://github.com/Devex/article_json
|
|
214
236
|
licenses:
|
215
237
|
- MIT
|
216
238
|
metadata: {}
|
217
|
-
post_install_message:
|
239
|
+
post_install_message:
|
218
240
|
rdoc_options: []
|
219
241
|
require_paths:
|
220
242
|
- lib
|
@@ -222,15 +244,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
244
|
requirements:
|
223
245
|
- - ">="
|
224
246
|
- !ruby/object:Gem::Version
|
225
|
-
version: '2.
|
247
|
+
version: '2.5'
|
226
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
249
|
requirements:
|
228
250
|
- - ">="
|
229
251
|
- !ruby/object:Gem::Version
|
230
252
|
version: '0'
|
231
253
|
requirements: []
|
232
|
-
rubygems_version: 3.
|
233
|
-
signing_key:
|
254
|
+
rubygems_version: 3.4.10
|
255
|
+
signing_key:
|
234
256
|
specification_version: 4
|
235
257
|
summary: JSON Format for News Articles & Ruby Gem
|
236
258
|
test_files: []
|