Skip to content

Commit

Permalink
Tag gmaps directions and mid as interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
automata committed Aug 9, 2016
1 parent 98e5b49 commit d23a4f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ module.exports = class Flatten
return 'video' if parsed.hostname.indexOf('livestream.com') isnt -1
return 'audio' if parsed.hostname.indexOf('soundcloud.com') isnt -1
return 'audio' if parsed.hostname.indexOf('bandcamp.com') isnt -1
return 'interactive' if parsed.hostname.indexOf('maps.google.') isnt -1 and parsed.pathname.indexOf('/directions') isnt -1
return 'interactive' if parsed.hostname.indexOf('www.google.com') isnt -1 and parsed.pathname.indexOf('/directions') isnt -1
return 'interactive' if parsed.hostname.indexOf('maps.google.') isnt -1 and parsed.query?.mid?
return 'interactive' if parsed.hostname.indexOf('www.google.com') isnt -1 and parsed.query?.mid?
return 'location' if parsed.hostname.indexOf('maps.google.') isnt -1
return 'location' if parsed.hostname.indexOf('www.google.com') isnt -1 and parsed.pathname.indexOf('/maps') isnt -1

Expand Down
10 changes: 9 additions & 1 deletion spec/Flatten.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe 'Flatten', ->
chai.expect(data).to.deep.eql expected
done()

it 'should be able to find Embed.ly videos and audios', (done) ->
it 'should be able to find Embed.ly media', (done) ->
if console.timeEnd
console.time 'flattening HTML structures'
sent =
Expand All @@ -121,6 +121,8 @@ describe 'Flatten', ->
<iframe src=\"https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.google.com%2Fmaps%2Fembed%2Fv1%2Fview%3Fmaptype%3Dsatellite%26center%3D35.0349449%252C-83.9676685%26key%3DAIzaSyBctFF2JCjitURssT91Am-_ZWMzRaYBm4Q%26zoom%3D15&url=https%3A%2F%2Fwww.google.com%2Fmaps%2F%4035.0349449%2C-83.9676685%2C585m%2Fdata%3D%213m1%211e3%3Fdg%3Ddbrw%26newdg%3D1&image=http%3A%2F%2Fmaps-api-ssl.google.com%2Fmaps%2Fapi%2Fstaticmap%3Fcenter%3D35.0349449%2C-83.9676685%26zoom%3D15%26size%3D250x250%26sensor%3Dfalse&key=b7d04c9b404c499eba89ee7072e1c4f7&type=text%2Fhtml&schema=google\" width=\"600\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"></iframe>
<iframe class="embedly-embed" src="//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ffast.wistia.net%2Fembed%2Fiframe%2Fmgdmzrzrm4%3Ftwitter%3Dtrue&src_secure=1&url=http%3A%2F%2Fdave.wistia.com%2Fmedias%2Fmgdmzrzrm4%3FembedType%3Dapi%26videoWidth%3D640&image=https%3A%2F%2Fembed-ssl.wistia.com%2Fdeliveries%2F1700d47fbfd310773b221d52e3a6d8c1cb91050a.jpg%3Fimage_crop_resized%3D640x360&key=internal&type=text%2Fhtml&schema=wistia" width="500" height="281" scrolling="no" frameborder="0" allowfullscreen></iframe>
<iframe src="//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fi.imgur.com%2FaK4RY7D.mp4&src_secure=1&url=http%3A%2F%2Fi.imgur.com%2FaK4RY7D.gifv&image=http%3A%2F%2Fi.imgur.com%2FaK4RY7D.gif%3Fnoredirect&key=b7d04c9b404c499eba89ee7072e1c4f7&type=video%2Fmp4&schema=imgur" width="718" height="404" scrolling="no" frameborder="0" allowfullscreen></iframe>
<iframe class="embedly-embed" src="//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.google.com%2Fmaps%2Fembed%2Fv1%2Fdirections%3Forigin%3DHakaniemi%252C%252B00530%252BHelsinki%252C%252BFinland%26destination%3DMustikkamaa%252C%252BHelsinki%252C%252BFinland%26center%3D60.182744%252C24.9565228%26key%3DAIzaSyBctFF2JCjitURssT91Am-_ZWMzRaYBm4Q%26zoom%3D14&url=https%3A%2F%2Fwww.google.com%2Fmaps%2Fdir%2FHakaniemi%2C%2B00530%2BHelsinki%2C%2BFinland%2FMustikkamaa%2C%2BHelsinki%2C%2BFinland%2F%4060.182744%2C24.9565228%2C14z%2Fdata%3D%213m1%214b1%214m14%214m13%211m5%211m1%211s0x46920bd487056237%3A0xdf979abdf5d04e9c%212m2%211d24.95006%212d60.17885%211m5%211m1%211s0x469209674cbc15a5%3A0x44e89871aabab498%212m2%211d24.99317%212d60.18217%213e2%3Fdg%3Ddbrw%26newdg%3D1&image=http%3A%2F%2Fmaps-api-ssl.google.com%2Fmaps%2Fapi%2Fstaticmap%3Fcenter%3D60.182744%2C24.9565228%26zoom%3D15%26size%3D250x250%26sensor%3Dfalse&key=internal&type=text%2Fhtml&schema=google" width="500" height="375" scrolling="no" frameborder="0" allowfullscreen></iframe>
<iframe class="embedly-embed" src="//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.google.com%2Fmaps%2Fd%2Fembed%3Fmid%3D11XCQ_V3rQaDTdIGVtvPd4aXUOmk%26hl%3Den_US&url=https%3A%2F%2Fwww.google.com%2Fmaps%2Fd%2Fviewer%3Fmid%3D11XCQ_V3rQaDTdIGVtvPd4aXUOmk%26hl%3Den_US&image=https%3A%2F%2Fwww.google.com%2Fmaps%2Fd%2Fthumbnail%3Fmid%3D11XCQ_V3rQaDTdIGVtvPd4aXUOmk%26hl%3Den_US&key=internal&type=text%2Fhtml&schema=google" width="500" height="375" scrolling="no" frameborder="0" allowfullscreen></iframe>
"""
]

Expand Down Expand Up @@ -158,6 +160,12 @@ describe 'Flatten', ->
type: 'video'
video: '//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fi.imgur.com%2FaK4RY7D.mp4&src_secure=1&url=http%3A%2F%2Fi.imgur.com%2FaK4RY7D.gifv&image=http%3A%2F%2Fi.imgur.com%2FaK4RY7D.gif%3Fnoredirect&key=b7d04c9b404c499eba89ee7072e1c4f7&type=video%2Fmp4&schema=imgur'
html: '<iframe src="//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fi.imgur.com%2FaK4RY7D.mp4&src_secure=1&url=http%3A%2F%2Fi.imgur.com%2FaK4RY7D.gifv&image=http%3A%2F%2Fi.imgur.com%2FaK4RY7D.gif%3Fnoredirect&key=b7d04c9b404c499eba89ee7072e1c4f7&type=video%2Fmp4&schema=imgur" width="718" height="404" scrolling="no" frameborder="0" allowfullscreen></iframe>'
,
type: 'interactive'
html: "<iframe src=\"//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.google.com%2Fmaps%2Fembed%2Fv1%2Fdirections%3Forigin%3DHakaniemi%252C%252B00530%252BHelsinki%252C%252BFinland%26destination%3DMustikkamaa%252C%252BHelsinki%252C%252BFinland%26center%3D60.182744%252C24.9565228%26key%3DAIzaSyBctFF2JCjitURssT91Am-_ZWMzRaYBm4Q%26zoom%3D14&url=https%3A%2F%2Fwww.google.com%2Fmaps%2Fdir%2FHakaniemi%2C%2B00530%2BHelsinki%2C%2BFinland%2FMustikkamaa%2C%2BHelsinki%2C%2BFinland%2F%4060.182744%2C24.9565228%2C14z%2Fdata%3D%213m1%214b1%214m14%214m13%211m5%211m1%211s0x46920bd487056237%3A0xdf979abdf5d04e9c%212m2%211d24.95006%212d60.17885%211m5%211m1%211s0x469209674cbc15a5%3A0x44e89871aabab498%212m2%211d24.99317%212d60.18217%213e2%3Fdg%3Ddbrw%26newdg%3D1&image=http%3A%2F%2Fmaps-api-ssl.google.com%2Fmaps%2Fapi%2Fstaticmap%3Fcenter%3D60.182744%2C24.9565228%26zoom%3D15%26size%3D250x250%26sensor%3Dfalse&key=internal&type=text%2Fhtml&schema=google\" width=\"500\" height=\"375\" scrolling=\"no\" frameborder=\"0\" allowfullscreen></iframe>"
,
type: 'interactive'
html: "<iframe src=\"//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.google.com%2Fmaps%2Fd%2Fembed%3Fmid%3D11XCQ_V3rQaDTdIGVtvPd4aXUOmk%26hl%3Den_US&url=https%3A%2F%2Fwww.google.com%2Fmaps%2Fd%2Fviewer%3Fmid%3D11XCQ_V3rQaDTdIGVtvPd4aXUOmk%26hl%3Den_US&image=https%3A%2F%2Fwww.google.com%2Fmaps%2Fd%2Fthumbnail%3Fmid%3D11XCQ_V3rQaDTdIGVtvPd4aXUOmk%26hl%3Den_US&key=internal&type=text%2Fhtml&schema=google\" width=\"500\" height=\"375\" scrolling=\"no\" frameborder=\"0\" allowfullscreen></iframe>"
]
]

Expand Down

0 comments on commit d23a4f5

Please sign in to comment.