有人试着分析过超级课程表或课程格子的 API 吗? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
document.addEventListener('DOMContentLoaded', function() { // Function to escape HTML entities function escapeHtml(text) { if (!text) return ''; var div = document.createElement('div'); div.textCOntent= text; return div.innerHTML; } // Function to render campaign based on display format function renderCampaign(campaign) { let html = ''; let displayFormat = campaign.display_format || 'text-only'; let title = escapeHtml(campaign.title); let description = escapeHtml(campaign.description); let callToAction = escapeHtml(campaign.call_to_action); let link = escapeHtml(campaign.link); // Check if required image URL is available for the display format, fallback to text-only if not if (displayFormat === 'small-with-description' && !campaign.img_small_url) { displayFormat = 'text-only'; } else if (displayFormat === 'banner-only' && !campaign.img_banner_url) { displayFormat = 'text-only'; } else if ((displayFormat === 'big-only' || displayFormat === 'big-with-description' || displayFormat === 'big-with-title-description-button') && !campaign.img_big_url) { displayFormat = 'text-only'; } html = `
${title}
`; switch(displayFormat) { case 'text-only': html += `
${description}
`; break; case 'small-with-description': html += `
${campaign.img_small_cid ? `
` : ''}
${description}
`; break; case 'banner-only': html += `
`; break; case 'big-only': html += `
`; break; case 'big-with-description': html += `
`; html += `
${description}
`; break; case 'big-with-title-description-button': html += `
`; html += `
${description}
`; html += ``; break; default: html += `
${description}
`; } html += `` return html; } // Load campaign from emitter var xhr = new XMLHttpRequest(); xhr.open('GET', '/pro/emitter', true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.Onreadystatechange= function() { if (xhr.readyState === 4) { if (xhr.status === 200) { try { var campaign = JSON.parse(xhr.responseText); if (campaign && campaign.id) { var html = renderCampaign(campaign); document.getElementById('pro-campaign-container').innerHTML = html; } else { // No campaign to display, hide the container document.getElementById('pro-campaign-container').style.display = 'none'; } } catch (e) { // Parse error, hide the container document.getElementById('pro-campaign-container').style.display = 'none'; console.log('Error parsing campaign data: ' + e.message); } } else { // HTTP error, hide the container document.getElementById('pro-campaign-container').style.display = 'none'; console.log('Error loading campaign: HTTP ' + xhr.status); } } }; xhr.send(); });
Hzzone

有人试着分析过超级课程表或课程格子的 API 吗?

  •  
  •   Hzzone 2017 年 9 月 28 日 5242 次点击
    这是一个创建于 3130 天前的主题,其中的信息可能已经有所发展或是发生改变。

    又这样一个想法,从超级课程表和课程格子获取课表,然后生成 ics 文件,导入到 Apple 日历,或者 Google 日历之类的应用里面,配合 iOS 食用简直美滋滋。

    14 条回复    2017-09-29 17:09:55 +08:00
    Wolther47
        1
    Wolther47  
       2017 年 9 月 28 日 via iPhone
    为什么不自己爬
    Lisp
        2
    Lisp  
       2017 年 9 月 28 日
    自己一个学校,很容易爬吧??
    Hzzone
        3
    Hzzone  
    OP
       2017 年 9 月 28 日
    @Lisp
    @Wolther47
    目标不是只支持一个学校或者 URP 这种教务系统:)
    Trim21
        4
    Trim21  
       2017 年 9 月 28 日 via iPhone
    之前给自己的学校写过。。
    什么需求会要用到很多学校的教务系统数据?二道贩子吗
    Hzzone
        5
    Hzzone  
    OP
       2017 年 9 月 28 日
    @Trim21 写得好玩,想做个轮子,和二道贩子有关系?
    Trim21
        6
    Trim21  
       2017 年 9 月 28 日 via iPhone
    @Hzzone 把课程表爬来的数据再爬一遍提供给别人,不就是二道贩子。。。
    Hzzone
        7
    Hzzone  
    OP
       2017 年 9 月 28 日
    @Trim21 emm..用课程表的轮子你要觉得二代贩子就二代贩子吧,大概和追书神器差不多?
    lzhr
        8
    lzhr  
       2017 年 9 月 28 日
    自己下载安装抓包,分析一下。

    @Trim21 #6 各种教务系统的课程信息不是光靠爬虫就能获取的
    nyanyh
        9
    nyanyh  
       2017 年 9 月 28 日
    好多学校的教务系统只能在内网用,这个不好解决啊
    zzmissu
        10
    zzmissu  
       2017 年 9 月 28 日
    我学校用的正方 分校内网和校外网入口
    Hzzone
        11
    Hzzone  
    OP
       2017 年 9 月 28 日
    @nyanyh
    @zzmissu
    用*课程格子或超级课程表*API 应该是没关系的吧?
    Wolther47
        12
    Wolther47  
       2017 年 9 月 29 日 via iPhone
    @Hzzone 可以当然是可以,但你又说做成 ics 放到日历里美滋滋。难道你要把全中国大学上个遍?
    Hzzone
        13
    Hzzone  
    OP
       2017 年 9 月 29 日 via iPhone
    @Wolther47 难道我解释的不够清楚吗?我想做个轮子,我就成了想把所有大学都上一遍?
    AaronLiu00
        14
    AaronLiu00  
    PRO
       2017 年 9 月 29 日 via Android
    有个 app 好像叫开源课表 可以实现
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     1152 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 65ms UTC 18:02 PVG 02:02 LAX 11:02 JFK 14:02
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86