דף 1 מתוך 1

YOUTUBE לא עובד בXBMC- מה הבעיה?

נשלח: 16/02/2013 10:00
על ידי yoni_98
שלום חברים,
המכשיר: XTREAMER ULTRA.
מערכת הפעלה: OPENELEC יחד עם XBMC בגרסה 2.99.2

תוסף היוטיוב מסרב לנגן קליפים אך מצליח להציג תמונות של תצוגה מקדימה לכל קליפ.
השגיאה המתקבלת:
"יותר מדי פריטים נכשלו- בדוק רישום קובץ לפרטים"
ו "לא מצליח למצוא כתובת וידאו".

מה הבעיה?
איך אני מוציא לוג של התקלה?
עד לא מזמן התוסף היה עובד חלק ללא שום בעיות.
ביצעתי הסרה והתקנה מחדש של התוסף אך ללא הצלחה.

אשמח לעזרה, תודה מראש.

נשלח: 16/02/2013 11:08
על ידי omerdo
היתה בעיה גורפת ויצא עדכון.
נסה לעקוב אחר ההודעות פה ולהוריד בהתאם -
http://forum.xbmc.org/showthread.php?tid=79487&page=296

נשלח: 16/02/2013 15:57
על ידי kevin
זה התיקון:
https://www.dropbox.com/l/axITMmdkQzSpIuDD

זה מסדיר הכל פרט לאפשרות החיפוש שעדיין לא עובדת

נשלח: 16/02/2013 17:11
על ידי yoni_98
עד לפני מס' ימים הכל עבד כשורה.
מוזר...
בכל אופן, ללא אפשרות החיפוש התוסף לא ממש שווה.

נשלח: 16/02/2013 17:34
על ידי pixies
קווין, אצלי החיפוש עובד בלי בעייה. כנראה בעייה ספציפית אצלך.

נשלח: 16/02/2013 17:38
על ידי yoni_98
אוקיי.. הורדתי את התיקון.
אך כאשר אני מנסה להתקין מתקבלת הודעת שגיאה:
"אין התאמה בתלויות"

מה זה??

נשלח: 16/02/2013 17:54
על ידי pixies
האם הורדת את הגירסה המתאימה לגירסת ה-XBMC שלך? יש גירסה ל-11 ויש גירסה ל-12.

נשלח: 16/02/2013 18:19
על ידי rabak
AppData\Roaming\XBMC\addons\plugin.video.youtube\YouTubePlayer.py

קוד: בחירת הכל

'''
   YouTube plugin for XBMC
    Copyright (C) 2010-2012 Tobias Ussing And Henrik Mosgaard Jensen

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http&#58;//www.gnu.org/licenses/>.
'''

import sys
import urllib
import cgi
try&#58; import simplejson as json
except ImportError&#58; import json


class YouTubePlayer&#40;&#41;&#58;
    fmt_value = &#123;
        5&#58; "240p h263 flv container",
        18&#58; "360p h264 mp4 container | 270 for rtmpe?",
        22&#58; "720p h264 mp4 container",
        26&#58; "???",
        33&#58; "???",
        34&#58; "360p h264 flv container",
        35&#58; "480p h264 flv container",
        37&#58; "1080p h264 mp4 container",
        38&#58; "720p vp8 webm container",
        43&#58; "360p h264 flv container",
        44&#58; "480p vp8 webm container",
        45&#58; "720p vp8 webm container",
        46&#58; "520p vp8 webm stereo",
        59&#58; "480 for rtmpe",
        78&#58; "seems to be around 400 for rtmpe",
        82&#58; "360p h264 stereo",
        83&#58; "240p h264 stereo",
        84&#58; "720p h264 stereo",
        85&#58; "520p h264 stereo",
        100&#58; "360p vp8 webm stereo",
        101&#58; "480p vp8 webm stereo",
        102&#58; "720p vp8 webm stereo",
        120&#58; "hd720",
        121&#58; "hd1080"
        &#125;

    # YouTube Playback Feeds
    urls = &#123;&#125;
    urls&#91;'video_stream'&#93; = "http&#58;//%s&safeSearch=none"
    urls&#91;'embed_stream'&#93; = "http&#58;//www.youtube.com/get_video_info?video_id=%s"
    urls&#91;'video_info'&#93; = "http&#58;//gdata.youtube.com/feeds/api/videos/%s"

    def __init__&#40;self&#41;&#58;
        self.xbmcgui = sys.modules&#91;"__main__"&#93;.xbmcgui
        self.xbmcplugin = sys.modules&#91;"__main__"&#93;.xbmcplugin

        self.pluginsettings = sys.modules&#91;"__main__"&#93;.pluginsettings
        self.storage = sys.modules&#91;"__main__"&#93;.storage
        self.settings = sys.modules&#91;"__main__"&#93;.settings
        self.language = sys.modules&#91;"__main__"&#93;.language
        self.dbg = sys.modules&#91;"__main__"&#93;.dbg

        self.common = sys.modules&#91;"__main__"&#93;.common
        self.utils = sys.modules&#91;"__main__"&#93;.utils
        self.cache = sys.modules&#91;"__main__"&#93;.cache
        self.core = sys.modules&#91;"__main__"&#93;.core
        self.login = sys.modules&#91;"__main__"&#93;.login
        self.subtitles = sys.modules&#91;"__main__"&#93;.subtitles

    def playVideo&#40;self, params=&#123;&#125;&#41;&#58;
        self.common.log&#40;repr&#40;params&#41;, 3&#41;
        get = params.get

        &#40;video, status&#41; = self.buildVideoObject&#40;params&#41;

        if status != 200&#58;
            self.common.log&#40;u"construct video url failed contents of video item " + repr&#40;video&#41;&#41;
            self.utils.showErrorMessage&#40;self.language&#40;30603&#41;, video&#91;"apierror"&#93;, status&#41;
            return False

        listitem = self.xbmcgui.ListItem&#40;label=video&#91;'Title'&#93;, iconImage=video&#91;'thumbnail'&#93;, thumbnailImage=video&#91;'thumbnail'&#93;, path=video&#91;'video_url'&#93;&#41;

        listitem.setInfo&#40;type='Video', infoLabels=video&#41;

        self.common.log&#40;u"Playing video&#58; " + repr&#40;video&#91;'Title'&#93;&#41; + " - " + repr&#40;get&#40;'videoid'&#41;&#41; + " - " + repr&#40;video&#91;'video_url'&#93;&#41;&#41;

        self.xbmcplugin.setResolvedUrl&#40;handle=int&#40;sys.argv&#91;1&#93;&#41;, succeeded=True, listitem=listitem&#41;

        if self.settings.getSetting&#40;"lang_code"&#41; != "0" or self.settings.getSetting&#40;"annotations"&#41; == "true"&#58;
            self.subtitles.addSubtitles&#40;video&#41;

        if &#40;get&#40;"watch_later"&#41; == "true" and get&#40;"playlist_entry_id"&#41;&#41;&#58;
            self.common.log&#40;u"removing video from watch later playlist"&#41;
            self.core.remove_from_watch_later&#40;params&#41;

        self.storage.storeValue&#40;"vidstatus-" + video&#91;'videoid'&#93;, "7"&#41;

    def getInfo&#40;self, params&#41;&#58;
        get = params.get
        video = self.cache.get&#40;"videoidcache" + get&#40;"videoid"&#41;&#41;
        if len&#40;video&#41; > 0&#58;
            self.common.log&#40;u"returning cache "&#41;
            return &#40;eval&#40;video&#41;, 200&#41;

        result = self.core._fetchPage&#40;&#123;"link"&#58; self.urls&#91;"video_info"&#93; % get&#40;"videoid"&#41;, "api"&#58; "true"&#125;&#41;

        if result&#91;"status"&#93; == 200&#58;
            video = self.core.getVideoInfo&#40;result&#91;"content"&#93;, params&#41;

            if len&#40;video&#41; == 0&#58;
                self.common.log&#40;u"- Couldn't parse API output, YouTube doesn't seem to know this video id?"&#41;
                video = &#123;&#125;
                video&#91;"apierror"&#93; = self.language&#40;30608&#41;
                return &#40;video, 303&#41;
        else&#58;
            self.common.log&#40;u"- Got API Error from YouTube!"&#41;
            video = &#123;&#125;
            video&#91;"apierror"&#93; = result&#91;"content"&#93;

            return &#40;video, 303&#41;

        video = video&#91;0&#93;
        self.cache.set&#40;"videoidcache" + get&#40;"videoid"&#41;, repr&#40;video&#41;&#41;
        return &#40;video, result&#91;"status"&#93;&#41;

    def selectVideoQuality&#40;self, params, links&#41;&#58;
        get = params.get

        print "links&#58; " + repr&#40;type&#40;links&#41;.__name__&#41;
        link = links.get
        video_url = ""

        self.common.log&#40;u""&#41;

        if get&#40;"action"&#41; == "download"&#58;
            hd_quality = int&#40;self.settings.getSetting&#40;"hd_videos_download"&#41;&#41;
            if &#40;hd_quality == 0&#41;&#58;
                hd_quality = int&#40;self.settings.getSetting&#40;"hd_videos"&#41;&#41;

        else&#58;
            if &#40;not get&#40;"quality"&#41;&#41;&#58;
                hd_quality = int&#40;self.settings.getSetting&#40;"hd_videos"&#41;&#41;
            else&#58;
                if &#40;get&#40;"quality"&#41; == "1080p"&#41;&#58;
                    hd_quality = 3
                elif &#40;get&#40;"quality"&#41; == "720p"&#41;&#58;
                    hd_quality = 2
                else&#58;
                    hd_quality = 1

        # SD videos are default, but we go for the highest res
        if &#40;link&#40;35&#41;&#41;&#58;
            video_url = link&#40;35&#41;
        elif &#40;link&#40;59&#41;&#41;&#58;
            video_url = link&#40;59&#41;
        elif link&#40;44&#41;&#58;
            video_url = link&#40;44&#41;
        elif &#40;link&#40;78&#41;&#41;&#58;
            video_url = link&#40;78&#41;
        elif &#40;link&#40;34&#41;&#41;&#58;
            video_url = link&#40;34&#41;
        elif &#40;link&#40;43&#41;&#41;&#58;
            video_url = link&#40;43&#41;
        elif &#40;link&#40;26&#41;&#41;&#58;
            video_url = link&#40;26&#41;
        elif &#40;link&#40;18&#41;&#41;&#58;
            video_url = link&#40;18&#41;
        elif &#40;link&#40;33&#41;&#41;&#58;
            video_url = link&#40;33&#41;
        elif &#40;link&#40;5&#41;&#41;&#58;
            video_url = link&#40;5&#41;

        if hd_quality > 1&#58;  # <-- 720p
            if &#40;link&#40;22&#41;&#41;&#58;
                video_url = link&#40;22&#41;
            elif &#40;link&#40;45&#41;&#41;&#58;
                video_url = link&#40;45&#41;
            elif link&#40;120&#41;&#58;
                video_url = link&#40;120&#41;
        if hd_quality > 2&#58;
            if &#40;link&#40;37&#41;&#41;&#58;
                video_url = link&#40;37&#41;
            elif link&#40;121&#41;&#58;
                video_url = link&#40;121&#41;

        if link&#40;38&#41; and False&#58;
            video_url = link&#40;38&#41;

        for fmt_key in links.iterkeys&#40;&#41;&#58;
            if link&#40;int&#40;fmt_key&#41;&#41;&#58;
                if self.dbg&#58;
                    text = repr&#40;fmt_key&#41; + " - "
                    if fmt_key in self.fmt_value&#58;
                        text += self.fmt_value&#91;fmt_key&#93;
                    else&#58;
                        text += "Unknown"

                    if &#40;link&#40;int&#40;fmt_key&#41;&#41; == video_url&#41;&#58;
                        text += "*"
                    self.common.log&#40;text&#41;
            else&#58;
                self.common.log&#40;u"- Missing fmt_value&#58; " + repr&#40;fmt_key&#41;&#41;

        if hd_quality == 0 and not get&#40;"quality"&#41;&#58;
            return self.userSelectsVideoQuality&#40;params, links&#41;

        if not len&#40;video_url&#41; > 0&#58;
            self.common.log&#40;u"- construct_video_url failed, video_url not set"&#41;
            return video_url

        if get&#40;"action"&#41; != "download"&#58;
            video_url += " | " + self.common.USERAGENT

        self.common.log&#40;u"Done"&#41;
        return video_url

    def userSelectsVideoQuality&#40;self, params, links&#41;&#58;
        levels =    &#91;&#40;&#91;37,121&#93;, u"1080p"&#41;,
                     &#40;&#91;22,45,120&#93;, u"720p"&#41;,
                     &#40;&#91;35,44&#93;, u"480p"&#41;,
                     &#40;&#91;18&#93;, u"380p"&#41;,
                     &#40;&#91;34,43&#93;,u"360p"&#41;,
                     &#40;&#91;5&#93;,u"240p"&#41;,
                     &#40;&#91;17&#93;,u"144p"&#41;&#93;

        link = links.get
        quality_list = &#91;&#93;
        choices = &#91;&#93;

        for qualities, name in levels&#58;
            for quality in qualities&#58;
                if link&#40;quality&#41;&#58;
                    quality_list.append&#40;&#40;quality, name&#41;&#41;
                    break

        for &#40;quality, name&#41; in quality_list&#58;
            choices.append&#40;name&#41;

        dialog = self.xbmcgui.Dialog&#40;&#41;
        selected = dialog.select&#40;self.language&#40;30518&#41;, choices&#41;

        if selected > -1&#58;
            &#40;quality, name&#41; = quality_list&#91;selected&#93;
            return link&#40;quality&#41;

        return u""

    def checkForErrors&#40;self, video&#41;&#58;
        status = 200

        if video&#91;u"video_url"&#93; == u""&#58;
            status = 303
            vget = video.get
            if vget&#40;u"live_play"&#41;&#58;
                video&#91;u'apierror'&#93; = self.language&#40;30612&#41;
            elif vget&#40;u"stream_map"&#41;&#58;
                video&#91;u'apierror'&#93; = self.language&#40;30620&#41;
            else&#58;
                video&#91;u'apierror'&#93; = self.language&#40;30618&#41;

        return &#40;video, status&#41;

    def buildVideoObject&#40;self, params&#41;&#58;
        self.common.log&#40;repr&#40;params&#41;&#41;

        &#40;video, status&#41; = self.getInfo&#40;params&#41;

        if status != 200&#58;
            video&#91;u'apierror'&#93; = self.language&#40;30618&#41;
            return &#40;video, 303&#41;

        video_url = self.subtitles.getLocalFileSource&#40;params, video&#41;
        if video_url&#58;
            video&#91;u'video_url'&#93; = video_url
            return &#40;video, 200&#41;

        &#40;links, video&#41; = self.extractVideoLinksFromYoutube&#40;video, params&#41;

        video&#91;u"video_url"&#93; = self.selectVideoQuality&#40;params, links&#41;

        &#40;video, status&#41; = self.checkForErrors&#40;video&#41;

        self.common.log&#40;u"Done"&#41;

        return &#40;video, status&#41;

    def extractFlashVars&#40;self, data&#41;&#58;
        flashvars = &#123;&#125;
        found = False

        for line in data.split&#40;"\n"&#41;&#58;
            if line.strip&#40;&#41;.startswith&#40;"yt.playerConfig"&#41;&#58;
                found = True
                p1 = line.find&#40;"="&#41;
                p2 = line.rfind&#40;";"&#41;
                if p1 <= 0 or p2 <= 0&#58;
                    continue
                data = line&#91;p1 + 1&#58;p2&#93;
                break

        if found&#58;
            data = json.loads&#40;data&#41;
            data = data&#91;"args"&#93;.items&#40;&#41;
            for k, v in data&#58;
				flashvars&#91;k&#93; = v
				
        self.common.log&#40;u"flashvars&#58; " + repr&#40;flashvars&#41;, 2&#41;
        return flashvars

    def scrapeWebPageForVideoLinks&#40;self, result, video&#41;&#58;
        self.common.log&#40;u""&#41;
        links = &#123;&#125;

        flashvars = self.extractFlashVars&#40;result&#91;u"content"&#93;&#41;
        if not flashvars.has_key&#40;u"url_encoded_fmt_stream_map"&#41;&#58;
            return links

        if flashvars.has_key&#40;u"ttsurl"&#41;&#58;
            video&#91;u"ttsurl"&#93; = flashvars&#91;u"ttsurl"&#93;

        for url_desc in flashvars&#91;u"url_encoded_fmt_stream_map"&#93;.split&#40;u","&#41;&#58;
            url_desc_map = cgi.parse_qs&#40;url_desc&#41;
            self.common.log&#40;u"url_map&#58; " + repr&#40;url_desc_map&#41;, 2&#41;
            if not &#40;url_desc_map.has_key&#40;u"url"&#41; or url_desc_map.has_key&#40;u"stream"&#41;&#41;&#58;
                continue

            key = int&#40;url_desc_map&#91;u"itag"&#93;&#91;0&#93;&#41;
            url = u""
            if url_desc_map.has_key&#40;u"url"&#41;&#58;
                url = urllib.unquote&#40;url_desc_map&#91;u"url"&#93;&#91;0&#93;&#41;
            elif url_desc_map.has_key&#40;u"conn"&#41; and url_desc_map.has_key&#40;u"stream"&#41;&#58;
                url = urllib.unquote&#40;url_desc_map&#91;u"conn"&#93;&#91;0&#93;&#41;
                if url.rfind&#40;"/"&#41; < len&#40;url&#41; -1&#58;
                    url = url + "/"
                url = url + urllib.unquote&#40;url_desc_map&#91;u"stream"&#93;&#91;0&#93;&#41;
            elif url_desc_map.has_key&#40;u"stream"&#41; and not url_desc_map.has_key&#40;u"conn"&#41;&#58;
                url = urllib.unquote&#40;url_desc_map&#91;u"stream"&#93;&#91;0&#93;&#41;

            if url_desc_map.has_key&#40;u"sig"&#41;&#58;
                url = url + u"&signature=" + url_desc_map&#91;u"sig"&#93;&#91;0&#93;

            links&#91;key&#93; = url

        return links

    def getVideoPageFromYoutube&#40;self, get&#41;&#58;
        login = "false"

        if self.pluginsettings.userHasProvidedValidCredentials&#40;&#41;&#58;
            login = "true"

        page = self.core._fetchPage&#40;&#123;u"link"&#58; self.urls&#91;u"video_stream"&#93; % get&#40;u"videoid"&#41;, "login"&#58; login&#125;&#41;

        if not page&#58;
            page = &#123;u"status"&#58;303&#125;

        return page

    def isVideoAgeRestricted&#40;self, result&#41;&#58;
        error = self.common.parseDOM&#40;result&#91;'content'&#93;, "div", attrs=&#123;"id"&#58; "watch7-player-age-gate-content"&#125;&#41;
        self.common.log&#40;repr&#40;error&#41;&#41;
        return len&#40;error&#41; > 0

    def extractVideoLinksFromYoutube&#40;self, video, params&#41;&#58;
        self.common.log&#40;u"trying website&#58; " + repr&#40;params&#41;&#41;
        get = params.get

        result = self.getVideoPageFromYoutube&#40;get&#41;
        if self.isVideoAgeRestricted&#40;result&#41; and self.pluginsettings.userName&#40;&#41; != ""&#58;
            self.login.login&#40;&#41;
            result = self.getVideoPageFromYoutube&#40;get&#41;

        if self.isVideoAgeRestricted&#40;result&#41;&#58;
            self.common.log&#40;u"Age restricted video"&#41;
            if not self.pluginsettings.userHasProvidedValidCredentials&#40;&#41;&#58;
                self.utils.showMessage&#40;self.language&#40;30600&#41;, self.language&#40;30622&#41;&#41;

        if result&#91;u"status"&#93; != 200&#58;
            self.common.log&#40;u"Couldn't get video page from YouTube"&#41;
            return &#40;&#123;&#125;, video&#41;

        links = self.scrapeWebPageForVideoLinks&#40;result, video&#41;

        if len&#40;links&#41; == 0&#58;
            self.common.log&#40;u"Couldn't find video url- or stream-map."&#41;

            if not u"apierror" in video&#58;
                video&#91;u'apierror'&#93; = self.core._findErrors&#40;result&#41;

        self.common.log&#40;u"Done"&#41;
        return &#40;links, video&#41;
הכל עובד אחרי זה

זה ל XBMC FRODO

נשלח: 16/02/2013 18:23
על ידי yoni_98
צודק...טעות שלי.
תודה רבה!!!!!!!!

נשלח: 16/02/2013 20:59
על ידי kevin
pixies כתב:קווין, אצלי החיפוש עובד בלי בעייה. כנראה בעייה ספציפית אצלך.
...
מה יכולה להיות הבעיה אצלי?

נשלח: 16/02/2013 21:01
על ידי pixies
סתם ניחוש - אולי זה בגלל שאתה לא Logged In. תנסה לעשות לוג אין ל-YouTube (עם חשבון הג'ימייל שלך, למשל).

נשלח: 16/02/2013 21:07
על ידי kevin
כמובן שאני logged in
אני רואה את כל המועדפים שלי רשימות השמעה וההעלאות שלי רק חיפוש זה לא נותן לי לעשות

נשלח: 16/02/2013 21:15
על ידי pixies
אין לי מושג מה זה יכול להיות - נסה להסיר את הפלאגין ואז ולהתקין אותו מחדש, ואם גם זה לא יעזור - התקנה של XBMC מחדש.