Skip to content

Instantly share code, notes, and snippets.

View santaux's full-sized avatar

Konstantin Grabar santaux

View GitHub Profile
Kostya Grabar Wed, 3 Oct at 11:33am
Hi everybody,
Yesterday I researched most of popular sites with videos: xvideos.com, xhamster.com, pornohub.com, youporn.com, redtube.com, youjizz.com, etc. Each of them gives an ability to embed video on other sites. So, we can parse html code, find embeding code and get the video from it. In 95% situations it is simple iframe tag with some parameters:
<iframe src="http://flashservice.xvideos.com/embedframe/964320" frameborder=0 width=510 height=400 scrolling=no></iframe>
Also, we really don't need to parse the iframe data, because we just have to know only video id (and it does not make sense what it is - numbers or text title) and link format, for example:
http://flashservice.xvideos.com/embedframe/964320 # 964320 is video id.
<<<<<<< HEAD
description = a.data("image-alt")
description = $('title').html() if description is undefined
contentType = a.data("content-type")
contentType = "image" if contentType is undefined
window.open("http://#{domain}/klips/new?layout=popup&klip[via]=bookmarklet&klip[tmp_remote_image_url]=#{imageSrc}&klip[image_w]=#{imageWidth}&klip[image_h]=#{imageHeight}&klip[original_url]=#{window.location.href}&klip[description]=#{description}&klip[content_type]=#{contentType}", "klipit_popup", "width=1010,height=640,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1")
=======
window.open("http://#{domain}/klips/new?layout=popup&klip[via]=bookmarklet&klip[tmp_remote_image_url]=#{imageSrc}&klip[image_w]=#{imageWidth}&klip[image_h]=#{imageHeight}&klip[original_url]=#{window.location.href}", "klipit_popup", "width=1010,height=640,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1")
# OLD routes:
/secrets/:id(.:format) secrets#show
secrets_with_sorting_secrets GET (/:city(/:locale))/secrets/:sorting(.:format) secrets#index {:sorting=>/map|categories/}
secrets_with_ordering_secrets GET (/:city(/:locale))/secrets/:ordering/:page(.:format) secrets#index {:ordering=>/allascending|alldescending/}
secrets_with_ordering_secrets GET (/:city(/:locale))/secrets/:ordering(.:format) secrets#index {:ordering=>/allascending|alldescending/}
secrets_with_category_name_secrets GET (/:city(/:locale))/secrets/:id(.:format) secrets#index
GET (/:city(/:locale))/secrets/:id/:page(.:format) secrets#index
map_secrets GET (/:city(/:locale))/secrets/map(.:format) secrets#map
promotion_secret GET (/:city(/:locale))/secrets/:id/promotion(.:format) secrets#p
@santaux
santaux / gist:3341224
Created August 13, 2012 14:27
Api Test Example
context 'read and accessible abilities' do
before(:each) do
Arch.destroy_all
User.destroy_all
@user = FactoryGirl.create(:user)
# Build Lists:
@build_list1 = FactoryGirl.create(:build_list_core)
@build_list2 = FactoryGirl.create(:build_list_core)
@santaux
santaux / braces_task.rb
Created August 2, 2012 09:49
Braces right checking
#!/usr/bin/ruby
#
# Checks braces balance
#
while true
# input
puts "Input:"
inpt = gets
@santaux
santaux / Fucken slow assets
Created July 18, 2012 05:01
Fucken slow assets
Started GET "/platforms/18/mass_builds" for 127.0.0.1 at 2012-07-18 08:58:17 +0400
Processing by Platforms::MassBuildsController#index as HTML
Parameters: {"platform_id"=>"18"}
...
Completed 200 OK in 437ms (Views: 396.7ms | ActiveRecord: 5.7ms)
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-07-18 08:58:18 +0400
Served asset /jquery.js - 304 Not Modified (0ms)
Started GET "/build_lists/publish_build" for 127.0.0.1 at 2012-06-20 11:03:25 +0000
Processing by Projects::BuildListsController#publish_build as patch
Parameters: {"status"=>"0", "id"=>"72071"}
Rendered text template (0.0ms)
Completed 200 OK in 12ms (Views: 5.3ms | ActiveRecord: 0.6ms)
Started GET "/build_lists/publish_build" for 127.0.0.1 at 2012-06-20 11:03:26 +0000
Processing by Projects::BuildListsController#publish_build as patch
Parameters: {"status"=>"1", "id"=>"72071"}
Failures:
1) Projects::BuildListsController callbacks publish_build should create correct git tag for correct commit
Failure/Error: build_list.project.git_repository.tags.last.name.should == build_list.package_version
NoMethodError:
undefined method `name' for nil:NilClass
# ./spec/controllers/projects/build_lists_controller_spec.rb:336:in `block (4 levels) in <top (required)>'
2) Projects::BuildListsController callbacks publish_build
Failure/Error: it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildList::BUILD_PUBLISHED) }
@santaux
santaux / gist:2912740
Created June 11, 2012 21:13
thin output
cache: [GET /orders/groups/add?group_id=111&url=http%3A%2F%2Fclub111&url_or_id=http%3A%2F%2Fvk.com%2Fclub111&username=santaux&password=123456] miss
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
X-UA-Compatible: IE=Edge,chrome=1
ETag: "9b22ece62d453e32c40946ef9c3671e8"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: _vkbroker_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJTAzMmM4NjAxOWI4NzI4ZjFlMWQzZjFkMDlhMWRlNDhiBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMW5URVdjUFhLU2hGMzFBVmVIckVIVVZCTmkwQi9IS2dxSGh4SC80aEIrQzA9BjsARkkiCmZsYXNoBjsARm86JUFjdGlvbkRpc3BhdGNoOjpGbGFzaDo6Rmxhc2hIYXNoCToKQHVzZWRvOghTZXQGOgpAaGFzaHsAOgxAY2xvc2VkRjoNQGZsYXNoZXN7BjoMc3VjY2Vzc0kiIEdyb3VwIHN1Y2Nlc3NmdWxseSBjcmVhdGVkIQY7AEY6CUBub3cw--1fca8c0cc38ad394e85c71cbf2778c08ff93be3b; path=/; HttpOnly
X-Runtime: 0.283967
Date: Mon, 11 Jun 2012 21:06:01 GMT
X-Rack-Cache: miss
@santaux
santaux / gist:2901088
Created June 9, 2012 14:02
em-synchrony + mongoid
# app/controllers/orders/groups_controller.rb
def add
if ab_auth params[:username], params[:password]
EM.synchrony do
10.times {
Group.create!(:group_id => params[:group_id], :url => params[:url], :url_or_id => params[:url_or_id])
}
end
flash[:success] = "Group successfully created!"