Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Commit

Permalink
Enhance: Support python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
grtfou committed Dec 30, 2014
1 parent 21a5111 commit 4d6e430
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
language: python

python:
- "2.6"
- "2.7"
- "3.0"
- "3.1"
- "3.2"
- "3.3"
- "3.4"
- "3.5"
# command to install dependencies
before_install:
- sudo apt-get update -qq
Expand Down
7 changes: 4 additions & 3 deletions gplus_crawler.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @first_date 20130414
# @date 20141230 - Fix: Certification on HTTPS connection
# @date 20141230 - Fix: Certification on HTTPS connection and support py3
"""
Download photo or videos from google plus
"""

from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division

import os
import re
Expand Down Expand Up @@ -173,7 +172,9 @@ def _get_url_context(self, uid, d_type):

if date_list and video_list and line == ']':
filename = "{}.mp4".format(date_list.group(1).replace('/', '-'))
video_url = video_list.group(1).replace(b'\u003d', b'=').replace(b'\u0026', b'&')
video_url = (video_list.group(1).encode('utf-8')
.replace(b'\u003d', b'=').replace(b'\u0026', b'&'))

print(filename)
filename = '{0}{1}video{1}{2}'.format(uid, os.sep, filename)

Expand Down
15 changes: 10 additions & 5 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @first_date 20140916
# @date 20141117 - Edit to unit test format
'''
# @date 20141230 - Added tearDown function
"""
Test main function for download image
'''
"""

import unittest
import sys, os
import sys
import os
import shutil

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

from gplus_crawler import GplusCrawler

class TestMainFunction(unittest.TestCase):
def setUp(self):
self.user_id = '115975634910643785199'

def tearDown(self):
self.user_id = None
if os.path.exists(self.user_id):
shutil.rmtree(self.user_id)

def test_video(self):
main_program = GplusCrawler()
Expand Down

0 comments on commit 4d6e430

Please sign in to comment.