Home  >  Article  >  Backend Development  >  Python development [Django]: combined search, JSONP, XSS filtering

Python development [Django]: combined search, JSONP, XSS filtering

高洛峰
高洛峰Original
2017-02-22 10:37:521838browse

1. Simple implementation

Associated files:

from django.conf.urls import url
from . import views

urlpatterns = [
    url(r'^index.html/$',views.index),
    url(r'^article/(?P47cf9185b9d6e565a16a5b103ea64946\d+)-(?Pc58a1130350e5f417b7f5c3a9765ab7e\d+).html/$',views.article)
]

url.py
76c82f278ac045591c9159d381de2c57
100db36a723c770d327fc0aef2ce13b1
93f0f5c25f18dab9d176bd4f6de5d30e
    a80eb7cbb6fff8b0ff70bae37074b813
    b2386ffb911b14667cb8f0f91ea547a7Title6e916e0f7d1e588d4f442bf645aedb2f
    c9ccee2e6ea535a969eb3f532ad9fe89
        .condition a{
            display:inline-block;
            padding: 3px 5px;
            border: 1px solid black;
        }
        .condition a.active{
            background-color: brown;
        }
    531ac245ce3e4fe3d50054a55f265927
9c3bca370b5104690d9ef395f2c5f8d1
6c04bd5ca3fcae76e30b72ad730ca86d
    c1a436a314ed609750bd7c7d319db4da过滤条件2e9b454fa8428549ca2e64dfac4625cd


    dc6dce4a544fdca2df29d5ac0ea9906b
        {% if kwargs.article_type == 0 %}
            c1650df1bf28ebb320e3f06f028cceca全部5db79b134e9f6b82c0b36e0489ee08ed
        {% else %}
            c1650df1bf28ebb320e3f06f028cceca全部5db79b134e9f6b82c0b36e0489ee08ed
        {% endif %}

        {% for row in article_type %}
            {% if row.id == kwargs.article_type %}
                8fc2ca070d67d215118cea57248d5115{{ row.caption }}5db79b134e9f6b82c0b36e0489ee08ed
            {% else %}
                f1c526059e6dca0aec95c389326630c2{{ row.caption }}5db79b134e9f6b82c0b36e0489ee08ed
            {% endif %}
        {% endfor %}
    16b28748ea4df4d9c2150843fecfba68

    dc6dce4a544fdca2df29d5ac0ea9906b
        {% if kwargs.category == 0 %}
            df70f7b565cfeab50f6266d13e7aae74全部5db79b134e9f6b82c0b36e0489ee08ed
        {% else %}
            df70f7b565cfeab50f6266d13e7aae74全部5db79b134e9f6b82c0b36e0489ee08ed
        {% endif %}

        {% for row in category %}
            {% if row.id == kwargs.category %}
                c5fdd0f19c8a956b13936b2ed0f418f2{{ row.caption }}5db79b134e9f6b82c0b36e0489ee08ed
            {% else %}
                c5fdd0f19c8a956b13936b2ed0f418f2{{ row.caption }}5db79b134e9f6b82c0b36e0489ee08ed
            {% endif %}
        {% endfor %}
    16b28748ea4df4d9c2150843fecfba68

    c1a436a314ed609750bd7c7d319db4da查询结果2e9b454fa8428549ca2e64dfac4625cd
    ff6d136ddc5fdfeffaf53ff6ee95f185
    {% for row in articles %}
        25edfb22a4f469ecb59f1190150159c6{{ row.id }}-{{ row.title }}------[{{ row.article_type.caption }}]-[{{ row.category.caption }}]bed06894275b65c1ab86501b08a632eb
    {% endfor %}
    929d1f5ca49e04fdcb27f9465b944689
36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e

article.html

Database structure:

from django.db import models
 
# Create your models here.
 
class Categoery(models.Model):
    caption = models.CharField(max_length=16)
 
class ArticleType(models.Model):
    caption = models.CharField(max_length=16)
 
class Article(models.Model):
 
    title = models.CharField(max_length=32)
    content = models.CharField(max_length=255)
 
    category = models.ForeignKey(Categoery)
    article_type = models.ForeignKey(ArticleType)

Processing files:

from . import  models
def article(request,*args,**kwargs):
 
    search_dict = {}
    for key,value in kwargs.items():
        kwargs[key] = int(value)        # 把字符类型转化为int类型 方便前端做if a == b  这样的比较
        if value !='0':
            search_dict[key] = value
    articles = models.Article.objects.filter(**search_dict) # 字典为空时表示搜索所有
 
    article_type = models.ArticleType.objects.all()
    category = models.Categoery.objects.all()
 
    return render(request,'article.html',{'articles':articles,
                                          'article_type':article_type,
                                         'category':category ,
                                          'kwargs':kwargs})

Note: It is not necessary to implement this function Difficult, the most important thing is to clarify the ideas inside; first, determine the url access path format http://127.0.0.1:8000/article/0-0.html, the first 0 represents the article_type field, and the second 0 Indicates the category field. If it is zero, it means searching for all information in this field. Confirming this is the first step to success. There is retrieval processing on the processing file; the second key point is to generate a dictionary search_dict for related searches. If If it is 0, it means searching all; the third key point is also a very clever way, passing the parameter kwargs to the front end again, it is a stroke of genius!

2. Another attempt (loading memory tuning)

Since the ArticleType type is fixed data for the blog, it will not be changed later, so you can load the data into the memory to speed up the query

76c82f278ac045591c9159d381de2c57
100db36a723c770d327fc0aef2ce13b1
93f0f5c25f18dab9d176bd4f6de5d30e
    a80eb7cbb6fff8b0ff70bae37074b813
    b2386ffb911b14667cb8f0f91ea547a7Title6e916e0f7d1e588d4f442bf645aedb2f
    c9ccee2e6ea535a969eb3f532ad9fe89
        .condition a{
            display:inline-block;
            padding: 3px 5px;
            border: 1px solid black;
        }
        .condition a.active{
            background-color: brown;
        }
    531ac245ce3e4fe3d50054a55f265927
9c3bca370b5104690d9ef395f2c5f8d1
6c04bd5ca3fcae76e30b72ad730ca86d
    c1a436a314ed609750bd7c7d319db4da过滤条件2e9b454fa8428549ca2e64dfac4625cd

    dc6dce4a544fdca2df29d5ac0ea9906b
        {% if kwargs.article_type_id == 0 %}
            9d54c0841deaf5461b945d32b7fb4fdc全部5db79b134e9f6b82c0b36e0489ee08ed
        {% else %}
            9d54c0841deaf5461b945d32b7fb4fdc全部5db79b134e9f6b82c0b36e0489ee08ed
        {% endif %}

        {% for row in article_type%}
            {% if row.0 == kwargs.article_type_id %}
                10f3f6439facab4314cfbe4e3175876d{{ row.1 }}5db79b134e9f6b82c0b36e0489ee08ed
            {% else %}
                a20c8a20660a4e1f867202ed670ff3b0{{ row.1 }}5db79b134e9f6b82c0b36e0489ee08ed
            {% endif %}
        {% endfor %}
    16b28748ea4df4d9c2150843fecfba68

    dc6dce4a544fdca2df29d5ac0ea9906b
        {% if kwargs.category_id == 0 %}
            73f255b70dccd9c638775a7513655ec1全部5db79b134e9f6b82c0b36e0489ee08ed
        {% else %}
            73f255b70dccd9c638775a7513655ec1全部5db79b134e9f6b82c0b36e0489ee08ed
        {% endif %}

        {% for row in category %}
            {% if row.id == kwargs.category_id %}
                51842ade3c1731ef36f6a85f509e3264{{ row.caption }}5db79b134e9f6b82c0b36e0489ee08ed
            {% else %}
                51842ade3c1731ef36f6a85f509e3264{{ row.caption }}5db79b134e9f6b82c0b36e0489ee08ed
            {% endif %}
        {% endfor %}
    16b28748ea4df4d9c2150843fecfba68

    c1a436a314ed609750bd7c7d319db4da查询结果2e9b454fa8428549ca2e64dfac4625cd
    ff6d136ddc5fdfeffaf53ff6ee95f185
    {% for row in articles %}
        25edfb22a4f469ecb59f1190150159c6{{ row.id }}-{{ row.title }}------[{{ row.article_type }}]-[{{ row.category.caption }}]bed06894275b65c1ab86501b08a632eb
    {% endfor %}
    929d1f5ca49e04fdcb27f9465b944689
36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e

article.html
from django.shortcuts import render
from django.shortcuts import HttpResponse

# Create your views here.

def index(request):


    return HttpResponse('Ok')


from . import  models
def article(request,*args,**kwargs):

    search_dict = {}
    for key,value in kwargs.items():
        kwargs[key] = int(value)        # 把字符类型转化为int类型 方便前端做if a == b  这样的比较
        if value !='0':
            search_dict[key] = value
    print(kwargs)
    articles = models.Article.objects.filter(**search_dict) # 字典为空时表示搜索所有

    article_type = models.Article.type_choice

    print(article_type)
    category = models.Categoery.objects.all()

    return render(request,'article.html',{'articles':articles,
                                          'article_type':article_type,
                                         'category':category ,
                                          'kwargs':kwargs})

处理文件.py

Database file:

from django.db import models
# Create your models here.
class Categoery(models.Model):
    caption = models.CharField(max_length=16)
 
# class ArticleType(models.Model):
#     caption = models.CharField(max_length=16)
 
class Article(models.Model):
    title = models.CharField(max_length=32)
    content = models.CharField(max_length=255)
 
    category = models.ForeignKey(Categoery)
    # article_type = models.ForeignKey(ArticleType)
    type_choice  = [
        (1,'Python'),
        (2,'Linux'),
        (3,'大数据'),
        (4,'架构'),
    ]
    article_type_id = models.IntegerField(choices=type_choice)

3. Use simple_tag to optimize the code

Associated files:

from django.db import models
# Create your models here.
class Categoery(models.Model):
    caption = models.CharField(max_length=16)

class ArticleType(models.Model):
    caption = models.CharField(max_length=16)

class Article(models.Model):
    title = models.CharField(max_length=32)
    content = models.CharField(max_length=255)

    category = models.ForeignKey(Categoery)
    article_type = models.ForeignKey(ArticleType)
    # type_choice  = [
    #     (1,'Python'),
    #     (2,'Linux'),
    #     (3,'大数据'),
    #     (4,'架构'),
    # ]
    # article_type_id = models.IntegerField(choices=type_choice)

数据库文件.py
from django.shortcuts import render
from django.shortcuts import HttpResponse

# Create your views here.

def index(request):


    return HttpResponse('Ok')


from . import models
def article(request, *args, **kwargs):
    search_dict = {}
    for key, value in kwargs.items():
        kwargs[key] = int(value)  # 把字符类型转化为int类型 方便前端做if a == b  这样的比较
        if value != '0':
            search_dict[key] = value
    articles = models.Article.objects.filter(**search_dict)  # 字典为空时表示搜索所有

    article_type = models.ArticleType.objects.all()

    print(article_type)
    category = models.Categoery.objects.all()


    return render(request, 'article.html', {'articles': articles,
                                            'article_type': article_type,
                                            'category': category,
                                            'kwargs': kwargs})

处理文件.py
{% load filter %}
76c82f278ac045591c9159d381de2c57
100db36a723c770d327fc0aef2ce13b1
93f0f5c25f18dab9d176bd4f6de5d30e
    a80eb7cbb6fff8b0ff70bae37074b813
    b2386ffb911b14667cb8f0f91ea547a7Title6e916e0f7d1e588d4f442bf645aedb2f
    c9ccee2e6ea535a969eb3f532ad9fe89
        .condition a{
            display:inline-block;
            padding: 3px 5px;
            border: 1px solid black;
        }
        .condition a.active{
            background-color: brown;
        }
    531ac245ce3e4fe3d50054a55f265927
9c3bca370b5104690d9ef395f2c5f8d1
6c04bd5ca3fcae76e30b72ad730ca86d
    c1a436a314ed609750bd7c7d319db4da过滤条件2e9b454fa8428549ca2e64dfac4625cd
    dc6dce4a544fdca2df29d5ac0ea9906b
        {% filter_all  kwargs 'article_type'%}

        {% filter_single article_type kwargs 'article_type'%}
    16b28748ea4df4d9c2150843fecfba68
    dc6dce4a544fdca2df29d5ac0ea9906b
        {% filter_all  kwargs 'category'%}
        {% filter_single category kwargs 'category'%}
    16b28748ea4df4d9c2150843fecfba68

    c1a436a314ed609750bd7c7d319db4da查询结果2e9b454fa8428549ca2e64dfac4625cd
    ff6d136ddc5fdfeffaf53ff6ee95f185
    {% for row in articles %}
        25edfb22a4f469ecb59f1190150159c6{{ row.id }}-{{ row.title }}------[{{ row.article_type.caption }}]-[{{ row.category.caption }}]bed06894275b65c1ab86501b08a632eb
    {% endfor %}
    929d1f5ca49e04fdcb27f9465b944689
36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e

article.html

Create templatetags directory , create the filter.py file in the directory:

from django import template
from django.utils.safestring import mark_safe
register = template.Library()
 
@register.simple_tag
def filter_all(kwargs,type_str):
    print(type_str)
    if type_str == 'article_type':
        if kwargs['article_type'] == 0:
            tmp = 'd0bc4868ae1f1ff1c94f379d51d89899 全部 5db79b134e9f6b82c0b36e0489ee08ed'%(kwargs['category'])
        else:
            tmp = '5b4a38184beb11dcff07b41757a60e18 全部 5db79b134e9f6b82c0b36e0489ee08ed'%(kwargs['category'])
 
    elif type_str == 'category':
        if kwargs['category'] == 0:
            tmp = '53ffd3320390aae5c9a1b7577e83bd73 全部 5db79b134e9f6b82c0b36e0489ee08ed' % (kwargs['article_type'])
        else:
            tmp = 'ea4c005b7a5cd7a87c1b4bb223203114 全部 5db79b134e9f6b82c0b36e0489ee08ed' % (kwargs['article_type'])
 
    return mark_safe(tmp)
 
@register.simple_tag()
def filter_single(type_obj,kwargs,type_str):
 
    print(type_str)
    tmp = ''
    if type_str == 'article_type':
        for row in type_obj:
            if row.id == kwargs['article_type']:
                tag = '9dba6e1a712676182e9928b187d05ff4%s5db79b134e9f6b82c0b36e0489ee08ed\n'%(row.id,kwargs['category'],row.caption)
            else:
                tag = 'd6329b2a69cc11866deec56d01dda4a9%s5db79b134e9f6b82c0b36e0489ee08ed\n' % (row.id, kwargs['category'],row.caption)
            tmp +=tag
    elif type_str == 'category':
        for row in type_obj:
            if row.id == kwargs['category']:
                tag = '9dba6e1a712676182e9928b187d05ff4%s5db79b134e9f6b82c0b36e0489ee08ed\n' % (kwargs['article_type'],row.id, row.caption)
            else:
                tag = 'd6329b2a69cc11866deec56d01dda4a9%s5db79b134e9f6b82c0b36e0489ee08ed\n' % (kwargs['article_type'], row.id, row.caption)
            tmp += tag
 
    return mark_safe(tmp)

HTML file main content:

{% load filter %}
6c04bd5ca3fcae76e30b72ad730ca86d
    c1a436a314ed609750bd7c7d319db4da过滤条件2e9b454fa8428549ca2e64dfac4625cd
    4981d39361bc2844bf84fbb6c43c223d
        {% filter_all  kwargs 'article_type'%}
 
        {% filter_single article_type kwargs 'article_type'%}
    16b28748ea4df4d9c2150843fecfba68
    4981d39361bc2844bf84fbb6c43c223d
        {% filter_all  kwargs 'category'%}
        {% filter_single category kwargs 'category'%}
    16b28748ea4df4d9c2150843fecfba68
 
    c1a436a314ed609750bd7c7d319db4da查询结果2e9b454fa8428549ca2e64dfac4625cd
    ff6d136ddc5fdfeffaf53ff6ee95f185
    {% for row in articles %}
        25edfb22a4f469ecb59f1190150159c6{{ row.id }}-{{ row.title }}------[{{ row.article_type.caption }}]-[{{ row.category.caption }}]bed06894275b65c1ab86501b08a632eb
    {% endfor %}
    929d1f5ca49e04fdcb27f9465b944689
36cc49f0c466276486e50c850b7e4956

JSONP

JSONP (JSON with Padding) is a "usage mode" of JSON ”, which can be used to solve the problem of cross-domain data access by mainstream browsers. Due to the same-origin policy, generally speaking, web pages located at server1.example.com cannot communicate with servers other than server1.example.com, with the exception of the HTML 3f1c4e4b6b16bbbd69b2ee476dc4f83a element. Using this open policy of the 3f1c4e4b6b16bbbd69b2ee476dc4f83a element, web pages can obtain JSON data dynamically generated from other sources, and this usage pattern is called JSONP. The data captured with JSONP is not JSON, but arbitrary JavaScript, which is executed with a JavaScript interpreter instead of parsed with a JSON parser.

Principle:

- Create script tag

- src=remote address

-The returned data must be in js format

- Only GET requests can be sent

1. What is the same origin policy?

Processing file:

import requests
def jsonp(request):
    # 获取url信息
    response = requests.get('http://weatherapi.market.xiaomi.com/wtr-v2/weather?cityId=101121301')
    response.encoding = 'utf-8'     # 进行编码
 
    return render(request,'jsonp.html',{'result':response.text})  # response.text 请求内容

HTML file:


    

后台获取的结果

{{ result }}

js直接获取结果

Note: When clicking js to directly obtain the results, the browser displays the following error message because the browser only accepts http:/ The information sent by /127.0.0.1:8000 is directly blocked for the information sent by the weather website. This is the same-origin policy. Is there any way to solve it?

XMLHttpRequest cannot load http://weatherapi.market.xiaomi.com/wtr-v2/weather?cityId=101121301. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access.

2. Cleverly use the src attribute of the script tag

The script tag is not affected by the same-origin policy

Processing files:

import requests
def jsonp(request):
    # 获取url信息
    response = requests.get('http://weatherapi.market.xiaomi.com/wtr-v2/weather?cityId=101121301')
    response.encoding = 'utf-8'     # 进行编码
 
    return render(request,'jsonp.html',{'result':response.text})  # response.text 请求内容
 
def jsonp_api(request):
    return HttpResponse('alert(123)')

HTML files:


    

后台获取的结果

{{ result }}

js直接获取结果

Note: For convenience when making js requests, the current program URL is still requested; after executing the above code, you will find a magical situation , a 123 message will pop up on the page, indicating that the script successfully obtained the information

3. Slightly modify the front and back ends to make the usage more dynamic

Processing files:

def jsonp(request):
 
    return render(request,'jsonp.html')  # response.text 请求内容
 
def jsonp_api(request):
    func = request.GET.get('callback')  # 获取用户callback参数
    content = '%s(10000)'%func          # 执行func(10000)函数
 
    return HttpResponse(content)

HTML file:


    

后台获取的结果

{{ result }}

js直接获取结果

Note: When js sends a request, bring the callback parameter, and then define the method corresponding to the parameter. The background will pass the data into this method and execute it; as for printing or The pop-up box depends on the user's own needs; the principle and implementation process of jsonp is the implementation of the above code

4. Example application+ajax

processing files :

import requests
def jsonp(request):
    response = requests.get('http://www.jxntv.cn/data/jmd-jxtv2.html?callback=list&_=1454376870403')
    response.encoding = 'utf-8'  # 进行编码
 
    return render(request, 'jsonp.html', {'result': response.text})  # response.text 请求内容

HTML file:


    

后台获取的结果

{{ result }}

js直接获取结果

list({data:[ { "week":"周日", "list":[ { "time":"0030", "name":"通宵剧场六集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0530", "name":"《都市现场》60分钟精编版(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0630", "name":"《快乐生活一点通》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0700", "name":"《e早晨报》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0800", "name":"精选剧场四集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1120", "name":"《地宝当家》(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1200", "name":"《都市60分》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1300", "name":"《谁是赢家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1400", "name":"女性剧场三集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1700", "name":"《快乐生活一点通》精编版", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1730", "name":"《地宝当家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1800", "name":"《都市现场》90分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1930", "name":"《都市情缘》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2000", "name":"《晚间800》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2020", "name":"《都市剧场》黄金剧(第1集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2110", "name":"《都市剧场》黄金剧(第2集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2200", "name":"《拍案》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2230", "name":"江西新闻联播(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2250", "name":"都市晚剧场", "link":"http://www.jxntv.cn/live/jxtv2.shtml" } ] }, { "week":"周一", "list":[ { "time":"0030", "name":"通宵剧场六集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0530", "name":"《都市现场》60分钟精编版(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0630", "name":"《快乐生活一点通》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0700", "name":"《e早晨报》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0800", "name":"精选剧场四集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1120", "name":"《地宝当家》(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1200", "name":"《都市60分》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1300", "name":"《谁是赢家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1400", "name":"女性剧场三集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1700", "name":"《快乐生活一点通》精编版", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1730", "name":"《地宝当家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1800", "name":"《都市现场》90分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1930", "name":"《都市情缘》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2000", "name":"《晚间800》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2020", "name":"《都市剧场》黄金剧(第1集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2110", "name":"《都市剧场》黄金剧(第2集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2200", "name":"《拍案》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2230", "name":"江西新闻联播(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2250", "name":"都市晚剧场", "link":"http://www.jxntv.cn/live/jxtv2.shtml" } ] },{ "week":"周二", "list":[ { "time":"0030", "name":"通宵剧场六集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0530", "name":"《都市现场》60分钟精编版(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0630", "name":"《快乐生活一点通》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0700", "name":"《e早晨报》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0800", "name":"精选剧场四集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1120", "name":"《地宝当家》(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1200", "name":"《都市60分》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1300", "name":"《谁是赢家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1400", "name":"女性剧场三集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1700", "name":"《快乐生活一点通》精编版", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1730", "name":"《地宝当家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1800", "name":"《都市现场》90分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1930", "name":"《都市情缘》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2000", "name":"《晚间800》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2020", "name":"《都市剧场》黄金剧(第1集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2110", "name":"《都市剧场》黄金剧(第2集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2200", "name":"《拍案》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2230", "name":"江西新闻联播(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2250", "name":"都市晚剧场", "link":"http://www.jxntv.cn/live/jxtv2.shtml" } ] },{ "week":"周三", "list":[ { "time":"0030", "name":"通宵剧场六集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0530", "name":"《都市现场》60分钟精编版(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0630", "name":"《快乐生活一点通》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0700", "name":"《e早晨报》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0800", "name":"精选剧场四集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1120", "name":"《地宝当家》(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1200", "name":"《都市60分》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1300", "name":"《谁是赢家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1400", "name":"女性剧场三集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1700", "name":"《快乐生活一点通》精编版", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1730", "name":"《地宝当家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1800", "name":"《都市现场》90分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1930", "name":"《都市情缘》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2000", "name":"《晚间800》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2020", "name":"《都市剧场》黄金剧(第1集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2110", "name":"《都市剧场》黄金剧(第2集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2200", "name":"《拍案》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2230", "name":"江西新闻联播(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2250", "name":"都市晚剧场", "link":"http://www.jxntv.cn/live/jxtv2.shtml" } ] },{ "week":"周四", "list":[ { "time":"0030", "name":"通宵剧场六集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0530", "name":"《都市现场》60分钟精编版(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0630", "name":"《快乐生活一点通》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0700", "name":"《e早晨报》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0800", "name":"精选剧场四集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1120", "name":"《地宝当家》(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1200", "name":"《都市60分》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1300", "name":"《谁是赢家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1400", "name":"女性剧场三集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1700", "name":"《快乐生活一点通》精编版", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1730", "name":"《地宝当家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1800", "name":"《都市现场》90分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1930", "name":"《都市情缘》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2000", "name":"《晚间800》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2020", "name":"《都市剧场》黄金剧(第1集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2110", "name":"《都市剧场》黄金剧(第2集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2200", "name":"《拍案》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2230", "name":"江西新闻联播(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2250", "name":"都市晚剧场", "link":"http://www.jxntv.cn/live/jxtv2.shtml" } ] },{ "week":"周五", "list":[ { "time":"0030", "name":"通宵剧场六集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0530", "name":"《都市现场》60分钟精编版(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0630", "name":"《快乐生活一点通》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0700", "name":"《e早晨报》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0800", "name":"精选剧场四集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1120", "name":"《地宝当家》(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1200", "name":"《都市60分》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1300", "name":"《谁是赢家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1400", "name":"女性剧场三集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1700", "name":"《快乐生活一点通》精编版", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1730", "name":"《地宝当家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1800", "name":"《都市现场》90分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1930", "name":"《都市情缘》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2000", "name":"《晚间800》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2020", "name":"《都市剧场》黄金剧(第1集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2110", "name":"《都市剧场》黄金剧(第2集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2200", "name":"《拍案》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2230", "name":"江西新闻联播(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2250", "name":"都市晚剧场", "link":"http://www.jxntv.cn/live/jxtv2.shtml" } ] },{ "week":"周六", "list":[ { "time":"0030", "name":"通宵剧场六集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0530", "name":"《都市现场》60分钟精编版(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0630", "name":"《快乐生活一点通》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0700", "name":"《e早晨报》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"0800", "name":"精选剧场四集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1120", "name":"《地宝当家》(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1200", "name":"《都市60分》60分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1300", "name":"《谁是赢家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1400", "name":"女性剧场三集连播", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1700", "name":"《快乐生活一点通》精编版", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1730", "name":"《地宝当家》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1800", "name":"《都市现场》90分钟直播版块", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"1930", "name":"《都市情缘》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2000", "name":"《晚间800》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2020", "name":"《都市剧场》黄金剧(第1集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2110", "name":"《都市剧场》黄金剧(第2集)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2200", "name":"《拍案》", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2230", "name":"江西新闻联播(重播)", "link":"http://www.jxntv.cn/live/jxtv2.shtml" }, { "time":"2250", "name":"都市晚剧场", "link":"http://www.jxntv.cn/live/jxtv2.shtml" } ] }] });

Note: The implementation process is exactly the same as the code written by the third person. It also creates a script and then deletes it

More Python Development [Django]: For articles related to combined search, JSONP, and XSS filtering, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn