$ git clone http://tcclient.ion.nu/tc_client.git
commit 488d316143118d9cce43a69427afdccbd6170f0a
Author: Alicia <...>
Date: Thu Mar 10 18:57:29 2016 +0100
modbot: if requesting by URL, skip to the ID.
diff --git a/ChangeLog b/ChangeLog
index af07d8c..0b8c6dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,7 @@ tc_client-gtk: use --hexcolors to show the full range of colors.
tc_client-gtk: keep cam pixel buffers on the heap instead of the stack, fixes glitchyness when resizing.
tc_client-gtk: fixed a memory leak.
modbot: use youtube-dl's 'ytsearch:' instead of '--default-search auto', fixes issues with search terms that include slashes.
+modbot: if requesting by URL, skip to the ID.
configure: check for multiple versions of ncurses.
0.37:
Reimplemented announcement of moderators.
diff --git a/utilities/modbot/modbot.c b/utilities/modbot/modbot.c
index 4c0fa80..93b6c1b 100644
--- a/utilities/modbot/modbot.c
+++ b/utilities/modbot/modbot.c
@@ -420,8 +420,10 @@ int main(int argc, char** argv)
unsigned int timeoffset=0;
char* timestr=strstr(&msg[9], "&t=");
if(!timestr){timestr=strstr(&msg[9], "?t=");}
+ if(!timestr){timestr=strstr(&msg[9], "#t=");}
if(timestr)
{
+ timestr[0]=0;
timestr=×tr[3];
while(timestr[0])
{
@@ -435,7 +437,11 @@ int main(int argc, char** argv)
timeoffset+=num;
}
}
- getvidinfo(&msg[9], "--get-id", vid, viderr, 1024);
+ char* request=&msg[9];
+ char* yturl;
+ if((yturl=strstr(request, "youtube.com/watch?v="))){request=&yturl[20];}
+ if((yturl=strstr(request, "youtu.be/"))){request=&yturl[9];}
+ getvidinfo(request, "--get-id", vid, viderr, 1024);
if(!vid[0]) // Nothing found
{
say(pm, "No video found, sorry (%s)\n", viderr);