[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I want to make an irc xdcc downloader, any suggestions on which

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 8
Thread images: 2

File: 59325521_p0.png (1MB, 1000x1357px) Image search: [Google]
59325521_p0.png
1MB, 1000x1357px
I want to make an irc xdcc downloader, any suggestions on which python libraries could I use or suggestions to implement? The idea is using a Greasemonkey script to replace the IRC chat commands on the website with a custom URI, so clicking on that on the browser automatically starts the application to download the file. That would be really nice. Thoughts on that?
>>
>>58598120
Want me to post the script I'm using?
>>
>XD
Get out.
>>
>>58599419
On second thought, the thing needs a security review before I post it anywhere, but I'm using weechat and python.
>>
File: xD.jpg (173KB, 591x506px) Image search: [Google]
xD.jpg
173KB, 591x506px
>>58599510
>>
>>58599419
Not OP but I'm interested
>>
>>58600222
download.user.js:
// ==UserScript==
// @name nibl DCC autodownload
// @namespace w7yhfvfuhsdgufhsdg
// @include http://nibl.co.uk/bots.php?search=*
// @version 0.1
// @grant none
// ==/UserScript==

var items = document.querySelectorAll('.botlistitem');
for (var i = 0; i < items.length; i++) {
var x = items[i];
var bot = x.querySelector('.botname').firstChild.textContent.trim();
var pack = x.querySelector('.packnumber').textContent;
var data = bot + ' ' + pack;
var url = 'data:application/x-dcc-download-pack,' + encodeURIComponent(data);
var link = document.createElement('a');
link.href = url;
link.textContent = '[download]';
link.className = 'link';
link.addEventListener('click', function(e) {e.stopPropagation();}, false);
var dest = x.querySelector('.filename');
dest.appendChild(document.createTextNode(' '));
dest.appendChild(link);
}


continued...
>>
>>58600828
download.sh (registered to handle application/x-dcc-download-pack type):
#!/bin/bash
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit
read -r dcc_bot dcc_pack < "$1"
export dcc_bot dcc_pack
gnome-terminal -x bash -c 'weechat -a -r "/python load download.py"' ""


download.py:
import weechat
import random
import string
import os
import re

NICK_TEST = r'^[A-Za-z\[\\\]^_`{|}][A-Za-z0-9\-\[\\\]^_`{|}]*$'
NUM_TEST = r'^[0-9]+$'

def join_cb(data, signal, signal_data):
bot = os.environ['dcc_bot']
pack = os.environ['dcc_pack']
if re.match(NICK_TEST, bot) and re.match(NUM_TEST, pack):
command = '/msg '+bot+' xdcc send #'+pack
weechat.command('', command)
weechat.unhook(hook_join)
return weechat.WEECHAT_RC_OK

def xfer_cb(data, signal, signal_data):
weechat.command('', '/quit')
return weechat.WEECHAT_RC_OK

weechat.register('download_pack', 'anon', '0.1', 'WTFPL', 'download XDCC pack', '', '')

hook_join = weechat.hook_signal('*,irc_in2_join', 'join_cb', '')
weechat.hook_signal('xfer_ended', 'xfer_cb', '')

nick = ''.join(random.choice(string.ascii_lowercase) for i in range(10))
weechat.command('', '/connect irc://'+nick+'@irc.rizon.net/#news')
Thread posts: 8
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.