Skip to content

Commit 92d81d1

Browse files
authored
Merge pull request #4681 from skipmodea1/matrix
[plugin.video.worldstarhiphop] 1.0.16+matrix.1
2 parents 6fd020f + 3c7bc03 commit 92d81d1

7 files changed

Lines changed: 297 additions & 490 deletions

File tree

plugin.video.worldstarhiphop/addon.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<addon
33
id="plugin.video.worldstarhiphop"
44
name="World Star Hip Hop"
5-
version="1.0.15+matrix.1"
5+
version="1.0.16+matrix.1"
66
provider-name="Skipmode A1">
77
<requires>
88
<import addon="xbmc.python" version="3.0.0"/>
99
<import addon="script.module.beautifulsoup4" version="4.3.2"/>
1010
<import addon="script.module.requests" version="2.4.3"/>
1111
<import addon="script.module.future" version="0.0.1"/>
1212
<import addon="script.module.html5lib" version="0.999.0"/>
13-
<import addon="script.module.youtube.dl" version="20.616.0+matrix.1"/>
13+
<import addon="script.module.youtube.dl" version="25.05.18+matrix.1"/>
1414
</requires>
1515
<extension point="xbmc.python.pluginsource" library="addon.py">
1616
<provides>video</provides>
@@ -30,7 +30,7 @@
3030
<icon>resources/icon.png</icon>
3131
<fanart>resources/fanart.jpg</fanart>
3232
</assets>
33-
<news>v1.0.15 (2023-10-11) (Kudos to jdig4240)
33+
<news>v1.0.16 (2025-07-01)
3434
- changes due to website changes
3535
</news>
3636
</extension>

plugin.video.worldstarhiphop/changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
v1.0.16 (2025-07-01)
2+
- changes due to website changes
3+
14
v1.0.15 (2023-10-11) (Kudos to jdig4240)
25
- changes due to website changes
36

plugin.video.worldstarhiphop/resources/language/resource.language.en_gb/strings.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,8 @@ msgstr ""
109109

110110
msgctxt "#30507"
111111
msgid "Error getting page: %s"
112+
msgstr ""
113+
114+
msgctxt "#30508"
115+
msgid "Error parsing JSON"
112116
msgstr ""

plugin.video.worldstarhiphop/resources/lib/worldstarhiphop_const.py

Lines changed: 92 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import sys
55
import os
66
import xbmc
7+
import xbmcgui
78
import xbmcaddon
9+
import urllib.parse
810
from bs4 import BeautifulSoup
911

1012
#
@@ -13,12 +15,13 @@
1315
ADDON = "plugin.video.worldstarhiphop"
1416
SETTINGS = xbmcaddon.Addon()
1517
LANGUAGE = SETTINGS.getLocalizedString
16-
BASEURLWSHH = "https://worldstarhiphop.com"
17-
BASEURLWS = "https://worldstar.com"
18+
BASE_URL_WSHH = "https://worldstarhiphop.com"
19+
INITIAL_API_VIDEO_URL = "https://api-mobile.worldstar.com/video/feed?daysSize=2&heroVideosSize=3&clean=false&pageCursor="
20+
INITIAL_API_SEARCH_URL = "https://api-mobile.worldstar.com/search/suggestion?searchTerm=<search_string>&pageSize=40&filter=newest&clean=false"
1821
IMAGES_PATH = os.path.join(xbmcaddon.Addon().getAddonInfo('path'), 'resources')
1922
HEADERS = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
20-
DATE = "2022-04-21"
21-
VERSION = "1.0.14"
23+
DATE = "2025-07-01"
24+
VERSION = "1.0.16"
2225

2326

2427
if sys.version_info[0] > 2:
@@ -48,4 +51,88 @@ def log(name_object, object):
4851

4952
def getSoup(html, default_parser="html5lib"):
5053
soup = BeautifulSoup(html, default_parser)
51-
return soup
54+
return soup
55+
56+
57+
def create_video_list_item(video_data, addon_name, images_path, log):
58+
"""
59+
Creates and configures an xbmcgui.ListItem for a video.
60+
61+
Args:
62+
video_data (dict): Dictionary containing video information.
63+
addon_name (str): The name of the addon.
64+
images_path (str): Path to the addon's images.
65+
log (function): The logging function to use.
66+
67+
Returns:
68+
xbmcgui.ListItem: The configured list item, or None if data is malformed.
69+
"""
70+
try:
71+
title = video_data.get('title', '')
72+
title_highlight = video_data.get('titleHighlight', '')
73+
description = video_data.get('description', '')
74+
duration = video_data.get('duration', 0)
75+
thumbnail_url = video_data.get('imageUrl', '')
76+
except KeyError as e:
77+
log("ERROR", f"Missing key in video data: {e}")
78+
return None # Return None if data is malformed
79+
80+
log("title", title)
81+
log("title_highlight", title_highlight)
82+
log("description", description)
83+
log("duration", duration)
84+
log("thumbnail_url", thumbnail_url)
85+
86+
if title_highlight == "":
87+
plot = description
88+
else:
89+
plot = title_highlight
90+
91+
log("plot", plot)
92+
93+
list_item = xbmcgui.ListItem(title)
94+
list_item.setInfo("video", {
95+
"title": title,
96+
"studio": addon_name,
97+
"plot": plot,
98+
"duration": duration
99+
})
100+
list_item.setArt({
101+
'thumb': thumbnail_url,
102+
'icon': thumbnail_url,
103+
'fanart': os.path.join(images_path, 'fanart-blur.jpg')
104+
})
105+
list_item.setProperty('IsPlayable', 'true')
106+
107+
# Add refresh option to context menu
108+
list_item.addContextMenuItems([('Refresh', 'Container.Refresh')])
109+
110+
return list_item
111+
112+
def add_video_to_listing(video_data, plugin_url, listing, addon_name, images_path, log):
113+
"""
114+
Processes a video dictionary, creates a list item, and appends it to the listing.
115+
116+
Args:
117+
video_data (dict): Dictionary containing video information.
118+
plugin_url (str): The base plugin URL.
119+
listing (list): The list to append the new list item to.
120+
addon_name (str): The name of the addon.
121+
images_path (str): Path to the addon's images.
122+
log (function): The logging function to use.
123+
"""
124+
list_item = create_video_list_item(video_data, addon_name, images_path, log)
125+
# Skip if list item creation failed
126+
if list_item is None:
127+
return
128+
129+
video_url = video_data.get('videoUrl', '')
130+
131+
log("video_url", video_url)
132+
133+
parameters = {"action": "play", "video_page_url": video_url}
134+
url = f"{plugin_url}?{urllib.parse.urlencode(parameters)}"
135+
is_folder = False
136+
137+
# Add our item to the listing as a 3-element tuple.
138+
listing.append((url, list_item, is_folder))

0 commit comments

Comments
 (0)