Example #1
0
    def test_get_embed(self):
        """
        get_embed() should return the HTML to embed the given Vimeo video.
        """
        embed_code = """<object width="425" height="344">\
<param name="allowfullscreen" value="true">\
<param name="allowscriptaccess" value="always">\
<param name="movie" value="\
http://vimeo.com/moogaloop.swf?show_byline=1&amp;fullscreen=1&amp;clip_id=2\
&amp;color=&amp;server=vimeo.com&amp;show_title=1&amp;show_portrait=0">\
<embed src="http://vimeo.com/moogaloop.swf?show_byline=1&amp;fullscreen=1&amp;\
clip_id=2&amp;color=&amp;server=vimeo.com&amp;show_title=1&amp;\
show_portrait=0" allowscriptaccess="always" height="344" width="425" \
allowfullscreen="true" type="application/x-shockwave-flash"></embed>\
</object>"""
        self.assertEquals(vimeo.get_embed(BASE_URL), embed_code)
Example #2
0
    def test_get_embed(self):
        """
        get_embed() should return the HTML to embed the given Vimeo video.
        """
        embed_code = """<object width="425" height="344">\
<param name="allowfullscreen" value="true">\
<param name="allowscriptaccess" value="always">\
<param name="movie" value="\
http://vimeo.com/moogaloop.swf?show_byline=1&amp;fullscreen=1&amp;clip_id=2\
&amp;color=&amp;server=vimeo.com&amp;show_title=1&amp;show_portrait=0">\
<embed src="http://vimeo.com/moogaloop.swf?show_byline=1&amp;fullscreen=1&amp;\
clip_id=2&amp;color=&amp;server=vimeo.com&amp;show_title=1&amp;\
show_portrait=0" allowscriptaccess="always" height="344" width="425" \
allowfullscreen="true" type="application/x-shockwave-flash"></embed>\
</object>"""
        self.assertEquals(vimeo.get_embed(BASE_URL), embed_code)
Example #3
0
def parse_entry(entry):
    parsed = {
        'title': entry['title'],
        'description': entry['caption'],
        'link': entry['urls']['url']['_content'],
        'thumbnail_url': entry['thumbnails']['thumbnail'][-1]['_content'],
        'publish_date': datetime.strptime(entry['upload_date'],
                                          '%Y-%m-%d %H:%M:%S'),
        'user': entry['owner']['fullname'],
        'user_url': 'http://vimeo.com/%s' % entry['owner']['username'],
        }
    parsed['file_url'] = vimeo_scraper.scrape_file_url(parsed['link'])
    parsed['embed'] = vimeo_scraper.get_embed(parsed['link'])
    if 'tags' in entry:
        parsed['tags'] = [tag['_content'] for tag in entry['tags']['tag']]

    return parsed