-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes
40 lines (34 loc) · 1.62 KB
/
notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<div class="red"><h1><%= tweet.attrs[:entities][:urls][0][:expanded_url] %></h1></div>
# begin
# long_url = LongURL.expand(params[:url])
# rescue
# end
# unless @article.attrs[:entities][:urls][0].nil?
# short_url = @article.attrs[:entities][:urls][0][:expanded_url]
# begin
# long_url = LongURL.expand(short_url)
# if Article.where(url:long_url).exists?
# article = Article.where(url:long_url)
# return article
# else
# source = open(long_url).read
# content = Readability::Document.new(source, :tags => %w[div p img a strong em], :attributes => %w[src href], :remove_empty_nodes => true).content
# current_user.articles << Article.create(url:long_url, content:content)
# end
# rescue
# end
# end
# if Article.where(url:long_url).exists?
# article = Article.where(url:long_url).first
# current_user.articles << article
# return article
# else
# source = open(long_url).read
# content = Readability::Document.new(source, :tags => %w[div p img a strong em], :attributes => %w[src href], :remove_empty_nodes => true).content
# current_user.articles << Article.create(url:long_url, content:content)
# end
# rescue
# end
# end
# end
# end