Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.gitignore
Gemfile
Gemfile.lock
LICENSE.txt
README.md
Rakefile
url_to_contents.gemspec

README.md

UrlToContents

Get some special contents base on URL.

The following contents are supported now:

  1. The Flash Player's url of video on youku.com
  2. The main content of post on weibo.com

Installation

Add this line to your application's Gemfile:

gem 'url_to_contents'

And then execute:

$ bundle

Or install it yourself as:

$ gem install url_to_contents

Usage

youku

url = UrlToContents::Url.new('http://v.youku.com/v_show/id_XMjk1MTM0Njky.html')

youku = url.parse
=> #<UrlToContents::Models::Youku:0x000000028cf170 @content="http://player.youku.com/player.php/Type/Folder/Fid/18443230/Ob/1/sid/XNDY1NDcwMDQ0/v.swf">

youku.content
=> "http://player.youku.com/player.php/sid/XMjk1MTM0Njky/v.swf"

weibo

url = UrlToContents::Url.new('http://weibo.com/1708332824/z11Bsbg1o')

weibo = url.parse
=> #<UrlToContents::Models::Weibo:0x00000002c11d60 @author="西岸男孩-小号", @content=":本周五晚上9点10分西岸男孩将亮相浙江卫视梦想秀,讲述我们这些年坎坷又执着的梦想道路,我将告诉大家除了唱歌以外我们的兼职工作。", @date="10月18日 11:36">

 weibo.author
=> "西岸男孩-小号"

weibo.content
=> ":本周五晚上9点10分西岸男孩将亮相浙江卫视梦想秀,讲述我们这些年坎坷又执着的梦想道路,我将告诉大家除了唱歌以外我们的兼职工作。"

weibo.date
=> "10月18日 11:36"

Contributing

  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Add some feature')

  4. Push to the branch (git push origin my-new-feature)

  5. Create new Pull Request

Something went wrong with that request. Please try again.