Face paketi olanlar icin bulunmaz biseydir tabi anlayana. Bundan sonraki guncellemeler bu kod uzerinden olacak. (Son videolari cekme, youtube linklerini direkt yapistirabilme vs..) Localhostta calismasi sizi herhangi bi websayfasina muhtac etmiycek.
Kodu .py yapip calistirin.
Not: kod icindeki sifreli kismi daha once yapmistim ve oylesine yapmistim bu konuda yoruma gerek yok yani
PHP Kod:
#-*-coding:utf8;-*-
#qpy:webapp:Hello Qpython
"""
This is a sample for qpython webapp
"""
a=""" <html prefix="og: http://ogp.me/ns#" ><head> <meta property="og:title" content="FACE VIDEO YUKLE" /> <meta property="og:description" content="CONTENT" /> <meta property="og:image" content="http://qpython.net/a.jpg" /> <meta property="fb:app_id" content="258516844482736" /> <meta property="fb:admins" content="103853929712808"/> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body{background: rgba(0,255,0, .3);} input.holo[type='text'] { /* You can set width to whatever you like */ width: 200px; font-family: "Roboto", "Droid Sans", sans-serif; font-size: 16px; margin: 0; padding: 8px 8px 6px 8px; position: relative; display: block; outline: none; border: none; background: bottom left linear-gradient(#a9a9a9, #a9a9a9) no-repeat, bottom center linear-gradient(#a9a9a9, #a9a9a9) repeat-x, bottom right linear-gradient(#a9a9a9, #a9a9a9) no-repeat; background-size: 1px 6px, 1px 1px, 1px 6px;}input.holo[type='text']:hover, input.holo[type='text']:focus { background: bottom left linear-gradient(#0099cc, #0099cc) no-repeat, bottom center linear-gradient(#0099cc, #0099cc) repeat-x, bottom right linear-gradient(#0099cc, #0099cc) no-repeat; background-size: 1px 6px, 1px 1px, 1px 6px; } </style>
</head><body> <script>var _0x2a65=["innerHTML","Video Facebook'a Yukleniyor..","value","url","title","message","me/videos","post","SELF","error","<b>Facebook'a yukleme tamamlandi..Facebook videonuzu kontrol ettikten sonra profilinizde gorebilirsiniz..</b>","api","publish_actions,user_videos","login"];function video(_0x2a35x2){sonuc[_0x2a65[0]]=_0x2a65[1];url=_0x2a35x2[_0x2a65[3]][_0x2a65[2]];title=_0x2a35x2[_0x2a65[4]][_0x2a65[2]];message=_0x2a35x2[_0x2a65[5]][_0x2a65[2]];FB[_0x2a65[13]](function(){FB[_0x2a65[11]](_0x2a65[6],_0x2a65[7],{"title":title,"description":message,"file_url":url,"privacy":{"value":_0x2a65[8]}},function(_0x2a35x3){if(_0x2a35x3&&!_0x2a35x3[_0x2a65[9]]){sonuc[_0x2a65[0]]=_0x2a65[10]}else {sonuc[_0x2a65[0]]=_0x2a35x3[_0x2a65[9]][_0x2a65[5]]}})},{"scope":_0x2a65[12]});return false}</script><font color="gray"><b>Facebook Video Yükleyici<b></font><br><br><form onsubmit="return video(this)"><input placeholder="URL Yapıştır (Zorunlu).." id="url" type="text" class="holo"/><br><input placeholder="Başlık.." id="title" type="text" class="holo"/> <br><input placeholder="Açıklama.." id="message" type="text" class="holo"/><br><input class="holo" type="submit" value="Facebook'a Yükle"/></form><br><a href="#" onclick="javascript:yardim.style.display='block'">Nasıl Kullanırım?</a><br><br><div id="yardim" style="display:none"><font size="2">Video Yukleme Sistemi'ni kullanabilmeniz için yorum kismina kullanmak istediginizi belirtmeniz gerekir. Aksi halde uygulama sizin adiniza paylaşım izni istemez..<br>Moderator arkadaslarımız en kısa sürede kullanıcı id'nizi sisteme girecektir..<br>Bu islemden sonra yuklemek istediginiz videonun direkt linkini ustteki kutuya yapistirip, Yukle butonuna basabilirsiniz.(opsiyonek olarak baslik ve aciklama girebilirsiniz)<br>Ornek direkt URL:<a href="http://techslides.com/demos/sample-videos/small.mp4">http://techslides.com/demos/sample-videos/small.mp4</a></font><a href="#" onclick="javascript:yardim.style.display='none'">Kapat</a></div><div id="sonuc"></div>
<div id="fb-root"></div><script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/tr_TR/sdk.js#xfbml=1&version=v2.5&appId=258516844482736"; fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script><div class="fb-comments" data-href="http://face-yukle.appspot.com" data-width="auto" data-numposts="10"></div></body></html>
"""
from bottle import Bottle, ServerAdapter
from bottle import run, debug, route, error, static_file, template
import threading,sys
import androidhelper
d=androidhelper.Android()
######### QPYTHON WEB SERVER ###############
class MyWSGIRefServer(ServerAdapter):
server = None
def run(self, handler):
from wsgiref.simple_server import make_server, WSGIRequestHandler
if self.quiet:
class QuietHandler(WSGIRequestHandler):
def log_request(*args, **kw): pass
self.options['handler_class'] = QuietHandler
self.server = make_server(self.host, self.port, handler, **self.options)
self.server.serve_forever()
def stop(self):
#sys.stderr.close()
import threading
threading.Thread(target=self.server.shutdown).start()
#self.server.shutdown()
self.server.server_close() #<--- alternative but causes bad fd exception
print "# qpyhttpd stop"
######### BUILT-IN ROUTERS ###############
@route('/__exit', method=['GET','HEAD'])
def __exit():
global server
server.stop()
@route('/__ping')
def __ping():
return "ok"
@route('/assets/<filepath:path>')
def server_static(filepath):
return static_file(filepath, root='/sdcard')
######### WEBAPP ROUTERS ###############
@route('/')
def home():
return template(a)
######### WEBAPP ROUTERS ###############
app = Bottle()
app.route('/', method='GET')(home)
app.route('/__exit', method=['GET','HEAD'])(__exit)
app.route('/__ping', method=['GET','HEAD'])(__ping)
app.route('/assets/<filepath:path>', method='GET')(server_static)
try:
server = MyWSGIRefServer(host="127.0.0.1", port="8001")
#app.run(server=server,reloader=False)
threading.Thread(target=app.run,kwargs={"server":server,"reloader":False}).start()
threading.Thread(target=d.view,args=("http://localhost:8001",)).start()
except Exception,ex:
print "Exception: %s" % repr(ex)