Skip to content

Commit 9762e15

Browse files
authored
Update main.py
1 parent a2c4161 commit 9762e15

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Pixabay Scraper/main.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Pixabay():
1313
1414
"""
1515
def __init__(self, verbose=True):
16-
self.__api_key = '38504833-19606430bd8fde504120d1630'
16+
self.bunch = '38504833-19606430bd8fde504120d1630'
1717
self.name = 'Pixabay'
1818
self.verbose = verbose
1919

@@ -29,7 +29,6 @@ def __get_params_video(self, query, num, update_params={}):
2929
Returns:
3030
```js
3131
{
32-
'key': API Key from Pixaby,
3332
'q': query given by user,
3433
'video_type': typeof video(default is film),
3534
'orientation': orientation of the video,
@@ -39,7 +38,6 @@ def __get_params_video(self, query, num, update_params={}):
3938
```
4039
"""
4140
params = {
42-
'key': self.__api_key,
4341
'q': query,
4442
'video_type': 'film',
4543
'orientation': 'horizontal',
@@ -61,8 +59,7 @@ def get_video(self, query, num=10, params={}):
6159
Returns: Downloads num number of videos into local storage.
6260
6361
"""
64-
if self.key == '':
65-
return 'Call setkey(key) method to set up the key first before using the scraper.'
62+
6663
BASE_URL = 'https://pixabay.com/api/videos/'
6764
_params = self.__get_params_video(query, num, params)
6865
response = requests.get(BASE_URL, params=_params)
@@ -89,7 +86,7 @@ def __get_params_photo(self, query, num, update_params={}):
8986
Returns:
9087
```js
9188
{
92-
'key': API Key from Pixaby,
89+
9390
'q': query given by user,
9491
'video_type': type of photo,
9592
'orientation': orientation of the photo,
@@ -99,7 +96,7 @@ def __get_params_photo(self, query, num, update_params={}):
9996
```
10097
"""
10198
params = {
102-
'key': self.__api_key,
99+
103100
'q': query,
104101
'image_type': 'photo',
105102
'orientation': 'horizontal',
@@ -120,8 +117,7 @@ def get_photo(self, query, num=10, params={}):
120117
Returns: Downloads num number of photos into local storage.
121118
122119
"""
123-
if self.key == '':
124-
return 'Call setkey(key) method to set up the key first before using the scraper.'
120+
125121
BASE_URL = 'https://pixabay.com/api/'
126122
_params = self.__get_params_photo(query, num, params)
127123
response = requests.get(BASE_URL, params=_params)

0 commit comments

Comments
 (0)