Skip to content

Instantly share code, notes, and snippets.

@dzjin
Created May 9, 2014 02:13
Show Gist options
  • Save dzjin/3f5c719595bef94fc9b4 to your computer and use it in GitHub Desktop.
Save dzjin/3f5c719595bef94fc9b4 to your computer and use it in GitHub Desktop.
def get_links
needle = /#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be\/)[^&\n]+#/
bracket_needle = /\[(.*?)\]/
links = @doc.search("a.title.may-blank").each do |x|
y = x['href']
t = y.scan(needle)
unless t.empty?
#important part is here
# puts x.text
matches = bracket_needle.match("Advancing through the Forest of Fallen Giants in Dark Souls 2 [Intentional][Whispering][Keyboard Sounds][Clicking]")
captures = matches.to_a
puts "======starts here"
captures.each do |e|
puts e
end
puts "======ends here"
puts t
#important part ends here
end
end
page_counter
end
@dzjin
Copy link
Author

dzjin commented May 9, 2014

======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here
[Intentional]
Intentional
======ends here
======starts here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment